1

I have several different elements on my page, and some of them are disabled. I want I way to be able to still use the ondblclick, and onclick events when the elements are disabled. I asked a previous question on this, and the answer that I received was to wrap the element in a <span>, which had a double click, therefore allowing the dblclick event to fire.

However, this does not work for all the elements on the page. I have <textarea>, <button>, <input type="text">, <input type="checkbox">, <input type="radio">. The <span> workaround does not work for all of these.

Why not? What can I do to make all of the elements ondblclick work even when they are disabled?

Demo

user2370460
  • 7,470
  • 10
  • 31
  • 46
  • 2
    You cannot. Disabled elements are impervious to mouse events. Even if you wrap them with `` elements, the events won't bubble up to them because they won't be handled in the first place. Consider using `readonly` instead of `disabled`. – Frédéric Hamidi Oct 18 '13 at 15:06
  • That's kind of the point of disabled elements. They are disabled. – Niet the Dark Absol Oct 18 '13 at 15:07
  • 4
    A similar question with a possible workaround was posted at [http://stackoverflow.com/questions/3100319/event-on-a-disabled-input](http://stackoverflow.com/questions/3100319/event-on-a-disabled-input) – arvidkahl Oct 18 '13 at 15:09
  • @FrédéricHamidi Can you tell me why using a span works with some elements, but not with others? – user2370460 Oct 18 '13 at 15:30
  • Probably because the other elements you speak of are not form controls, and as such cannot be disabled in the first place. – Frédéric Hamidi Oct 18 '13 at 15:35

0 Answers0