});
}
- if ( this.type === "checkbox") {
+ if ( this.type === "checkbox" ) {
this.buttonElement.bind( "click.button", function() {
if ( options.disabled ) {
return;
$( this ).toggleClass( "ui-state-active" );
self.buttonElement.attr( "aria-pressed", self.element[0].checked );
});
- } else if ( this.type === "radio") {
+ } else if ( this.type === "radio" ) {
this.buttonElement.bind( "click.button", function() {
if ( options.disabled ) {
return;
$( this ).removeClass( "ui-state-active" );
})
.bind( "keydown.button", function(event) {
- if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
+ if ( options.disabled ) {
+ return;
+ }
+ if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
$( this ).addClass( "ui-state-active" );
}
})
// TODO: pull out $.Widget's handling for the disabled option into
// $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
// be overridden by individual plugins
- $.Widget.prototype._setOption.call( this, "disabled", options.disabled );
- this._resetButton();
+ this._setOption( "disabled", options.disabled );
},
_determineButtonType: function() {
}
});
-}( jQuery ));
+}( jQuery ) );