Reputation: 10509
There are a lot of questions on exactly opposite on what I want to achieve.
I need my to raise an .click
attached function even when the button is disabled (disabled attribute set on it).
I need to do this in jQuery 1.7.1 and don't want to hack into it with an errors in deprecated API's.
I know this is kind of "against the rules of logic", but can this be done?
For example the button is disabled and in order to enable it a user needs to check one of the check boxes. I need to shake the title of the check boxes on disabled button click in that case for better user experience.
Upvotes: 1
Views: 248
Reputation: 6573
managed to get this to work in chrome. this just monoitors mouseout of the form and sees if the target is dsiabled maybe see if you can take it that bit further?
You could bind a click event to the document inside the statement detecting if element is disabled to call the requied function and unbind it when form gets mouseover back from a disabled element.
simulated hover on disabled element
Upvotes: 0
Reputation: 4348
I would suggest adding a transparent span covering your button in cases where it is disabled, and attaching the the click event to it instead. As far as I know, it isn't possible to trigger mouse events of a button (using the mouse - it is possible with the trigger method) while it is disabled.
Upvotes: 3
Reputation: 9092
Is it ok for you to use the trigger
method?
If so, take a look at this demo: http://jsfiddle.net/schawaska/X6rzg/
Upvotes: 0