jQuery Mobile how to check if button is disabled?
try :is
selector
$("#deliveryNext").is(":disabled")
Use .prop instead:
$('#deliveryNext').prop('disabled')
Faced with the same issue when trying to check if a button is disabled. I've tried a variety of approaches, such as btn.disabled
, .is(':disabled')
, .attr('disabled')
, .prop('disabled')
. But no one works for me.
Some, for example .disabled
or .is(':disabled')
returned undefined
and other like .attr('disabled')
returned the wrong result - false
when the button was actually disabled.
But only one technique works for me: .is('[disabled]')
(with square brackets).
So to determine if a button is disabled try this:
$("#myButton").is('[disabled]');