jQuery Mobile how to check if button is disabled?

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

$(document).ready(function() {

and i can enable it with


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

This command gives "undefined":


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?


try :is selector


Use .prop instead:




The following code works for me:

<script type="text/javascript">
    $(document).ready(function () {
    <button id="testButton">Testing</button>

http://jsfiddle.net/8gfYZ/11/ Check here..


        if( $('#myButton').prop('disabled') ) { 
        else {

To see which options have been set on a jQuery UI button use:


To check if it's disabled you can use:

$("#deliveryNext").button('option', 'disabled')

Unfortunately, if the button hasn't been explicitly enabled or disabled before, the above call will just return the button object itself so you'll need to first check to see if the options object contains the 'disabled' property.

So to determine if a button is disabled you can do it like this:

$("#deliveryNext").button('option').disabled != undefined && $("#deliveryNext").button('option', 'disabled')

i had the same problem and i found this is working

if this gives you undefined then you can use if condition also

      //Not Disabled 

when you evaluate undefined it will return false

$('#StartButton:disabled') ..

Then check if it's undefined.

What worked for me was this:


But I like tomwadley's answer a lot more.

Nevertheless, the is(':disabled') code does also not work for me which should be the best version. Don't know, why it does not work. :-(



Need Your Help

Glossy materials in THREE.js


How can we create glossy effects on materials with three.js like the one on this link?

JSON data to HTML

javascript php html json cordova

I am learning phonegap application, but I have some problem on the process.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.