Fiddle: http://jsfiddle.net/ugzux/
As you can see, I have a form with a disabled (via javascript) submit button.
I want to be able to bind a click event to it anyway, so I can do some jazzy indication of what needs to be fixed on the input before I'll allow the form to be submitted (i.e enable the button again).
However, disabling the submit button also apparently disables any click events bound to the button, even if they are bound after the disable - any idea how to get around this?
Practically, one solution is to stop disabling the button and instead have an event that does
$('form').submit(function(event){
event.preventDefault();
});
However I want to know the ins and outs of disabled inputs and javascript events, and if there are workarounds as I've never encountered this behaviour before.
A form control that is disabled must prevent any click events that are queued on the user interaction task source from being dispatched on the element
, so I guess it can be considered as documented (and browsers using a toolkit that does relay click events to disabled controls should arguably ignore them in order to be compliant). – Metamathematics