Making an element unselectable using jQuery

Posted by Acorn on Stack Overflow See other posts from Stack Overflow or by Acorn
Published on 2010-04-30T13:00:42Z Indexed on 2010/04/30 13:07 UTC
Read the original article Hit count: 783

Filed under:
|
|

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 cross browser compatible that is.

I also see someone's made a jQuery plugin: http://plugins.jquery.com/project/Unselectable .. would a plugin like that be necessary?

Is there a simple, compatible way to make an element unselectable?

The reason for wanting to do this is purely aesthetic. With webpages that have dragging or click events, it's not very nice when things get selected.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html