Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable click on a div

Tags:

javascript

I want to disable click on a certain <div> so that when you select the text on it, the text doesn't select.

I tried writing onclick="return false;" like in this fiddle http://jsfiddle.net/mageek/X6hqD/ but it doesn't work.

How can it work? (My goal isn't just disabling the select, it's the whole click).

like image 974
Mageek Avatar asked Dec 20 '22 19:12

Mageek


1 Answers

document.getElementById('div1').onmousedown = new function ("return false");
like image 96
Kasidesh Yontaradidthaworn Avatar answered Jan 03 '23 03:01

Kasidesh Yontaradidthaworn