I know I can disable text selection for a div but that is not what I want.

I have this jquery color picker and as you can see on the webpage in the flat example, if you pick a color keep the mouse pressed and move all over the page nothing get's selected. That is what I want but somehow it does not work in my example:

http://jsfiddle.net/x6sAT/3/

$('#colorSelector').ColorPicker({
    color: '#ff0000',
    flat: true,
    ...
});

Even if I disable text selection on the color picker you are still able to select the text around by moving the clicked mouse.

enter image description here

I could disable text select on the whole page but that would not be nice.

How do I fix this?

有帮助吗?

解决方案

Do you want it like this: http://jsfiddle.net/Praveen16oct90/x6sAT/5/

document.getElementById("text_selectable").onmousedown = function(event)
{
    event.preventDefault();
    return false;
}

Give ID for HTML as 'text_selectable' and use it. <html id="text_selectable">

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top