0

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?

4

1 回答 1

1

你想要这样吗:http: //jsfiddle.net/Praveen16oct90/x6sAT/5/

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

将 HTML 的 ID 设为“text_selectable”并使用它。<html id="text_selectable">

于 2013-05-06T06:58:28.437 回答