if i use this style for the <body>
onmousedown='return false;' onselectstart='return false;'
is it possible to give the exceptions by using javascript for inputs textareas and selects? and if yes then can u show me how?
if i use this style for the <body>
onmousedown='return false;' onselectstart='return false;'
is it possible to give the exceptions by using javascript for inputs textareas and selects? and if yes then can u show me how?
Actually, you can disable text selection without needing heavy-handed JavaScript event handlers. See my answer here: How to disable text selection highlighting using CSS?
Summary: use CSS and the
unselectable
expando in IE.CSS:
HTML:
You need to prevent event bubbling for textboxes and selects.
You can use
:input
selector to select all input, textarea, select and button elements.Something like
See a working demo