jQuery Mobile how to check if button is disabled?

RickardP picture RickardP · Jun 22, 2011 · Viewed 123.4k times · Source

I disable the button like this on my jQuery Mobile webpage:

$(document).ready(function() {
    $("#deliveryNext").button();
    $("#deliveryNext").button('disable');
});

and i can enable it with

$("#deliveryNext").button('enable');

But how do i check if the button is disabled or enabled?

This command gives "undefined":

$("#deliveryNext").attr('disabled')

Some ideas?

Edit: i find out that $("#deliveryNext").button('disable') only seams to change the style on the button, the clicking works fine after so i need to disable the button some how also.. i tried .attr('disabled', 'disabled') but when i then test .attr('disabled') i get undefined...

Edit2: more about my "real" problem at How to disable a link button in jQuery Mobile?

Answer

Vivek picture Vivek · Jun 22, 2011

try :is selector

$("#deliveryNext").is(":disabled")