I have this problem, I need to add onmousedown
and onselectstart
events to certain html elements. I've tried with this but as they are not attributes this doesn't work.
$(".question, p, b, span, img").each(function(){
$(this).addClass("disableSelection");
$(this).attr("onmousedown", "return false;");
$(this).attr('onselectstart', 'return false;');
});
Any ideas?
Example
<p onmousedown="return false;" onselectstart="return false;">Adding events</p>