Making An Element Unselectable Using Jquery
What's the best way to make an element unselectable using jQuery? I know you can use onselectstart='return false;' ondragstart='return false;' in the HTML, but I'm not sure how cro
Solution 1:
$('.noselect').live('selectstart dragstart', function(evt){ evt.preventDefault(); return false; });
Just bind the event to a live, and return false, or prevent default.
Solution 2:
I think jQuery will abstract the browser variance & so it will help you make HTML elements unselectable.
Having said that, please note that the client can decide to switch off javascript, in which case you need to ensure that he still cannot do anything that will cause harm...
HTH.
Solution 3:
If you use JqueryUI you can set class="ui-state-default"
to the div that you dont want to be selected.
<divclass="ui-state-default"></div>
Post a Comment for "Making An Element Unselectable Using Jquery"