Ticket #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: | ||
| Blocking: | Blocked by: |
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
comment:2 Changed 16 months ago by Scott González
- Status changed from new to closed
- Resolution set to fixed
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 16 months 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


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.