Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#8028 closed bug (fixed)

Getting unset disabled option on button widget returns jQuery object, not default value

Reported by: mikemccaughan Owned by:
Priority: minor Milestone: 1.8.18
Component: ui.button Version: 1.8.16
Keywords: Cc:
Blocked by: Blocking:

Description

I need to determine whether a button is disabled or not. I assumed that calling the option method would do it:

var disabled = $('.button').button('option', 'disabled');
if (disabled) { ... }

When run against a button which was initialized without the disabled option set, it returns the $('.button') result, rather than the default false as I expected.

See also http://jsfiddle.net/HNAf7/3/.

Change History (4)

comment:1 Changed 11 years ago by mikemccaughan

The workaround is obviously to check for a Boolean true, but it still seems somewhat confusing, especially given using the same format for the text option does return its Boolean default value.

comment:2 Changed 11 years ago by Scott González

Resolution: fixed
Status: newclosed

Button: Properly handle disabled option on init. Fixes #8028 - Getting unset disabled option on button widget returns jQuery object, not default value.

Changeset: 3a1031e58b717b042d39dcccfdbe1d293cdbecf1

comment:3 Changed 11 years ago by Scott González

Button: Properly handle disabled option on init. Fixes #8028 - Getting unset disabled option on button widget returns jQuery object, not default value. (cherry picked from commit 3a1031e58b717b042d39dcccfdbe1d293cdbecf1)

Conflicts:

ui/jquery.ui.button.js

Changeset: f7f13b5949cd59f4e3f70c315d4e18f9662281ad

comment:4 Changed 11 years ago by Scott González

Milestone: 1.91.8.18
Note: See TracTickets for help on using tickets.