I have a form with some inputs disabled. I want these inputs to be enabled when double clicked. Unfortunately, JS events seem not to fire on disabled inputs.
<input type="text" value="asdf" disabled="disabled" ondblclick="this.disabled=false;">
Is there a way around this limitation?
Or am I just going to have to wrap any affected input in a span to house the event?
Advertisement
Answer
ondblclick
does not get fired on a disabled
element, you should mark it as readonly
:
<input type="text" value="asdf" readonly="true" ondblclick="this.readOnly='';">