Disabled buttons should get the ui-disabled class. I created a refresh() method to be consistent with other widgets. It checks if the underlying button is disabled and calls enable or disable. The refresh() method is called from _create.

This commit is contained in:
cm71td 2011-03-24 06:42:54 +08:00 committed by Scott Jehl
parent ff4c74d5f9
commit 2f3b5b6543

View file

@ -48,6 +48,7 @@ $.widget( "mobile.button", $.mobile.widget, {
});
});
}
this.refresh();
},
@ -61,6 +62,15 @@ $.widget( "mobile.button", $.mobile.widget, {
this.element.attr("disabled", true);
this.button.addClass("ui-disabled").attr("aria-disabled", true);
return this._setOption("disabled", true);
},
refresh: function(){
if( this.element.attr('disabled') ){
this.disable();
}
else{
this.enable();
}
}
});
})( jQuery );