Closed robinmajor closed 10 years ago
Let me check, Would you be able to post a sample of the issue some where like http://jsfiddle.net?
This is not an issue.
Unlike other attribute, disabled itself is a boolean value, meaning if the attribute is present then it means it is disabled. Disabled attribute doesn't take any value.
Read about boolean value here http://www.w3.org/TR/html5/infrastructure.html#boolean-attribute
The HTML5 disabled input syntax is like below,
<input type="text" disabled />
which is also equivalent to
<input type="text" disabled="enabled" />
<input type="text" disabled="false" />
<input type="text" disabled="no" />
All the above HTML will render you a disabled input ( http://jsfiddle.net/p69Hd/ )
When an element is disabled, the plugin sets the old value as null and new value as "disabled".
When an element is enabled, the plugin sets the old value as "" and new value as "undefined" as the attribute is removed from the element.
Let me know if it works as above.
Thanks for the feedback. The problem was that trackValues was not set to true. Correcting this fixed the issue and it now works as you describe.
I'm trying to use this to detect changes to a submit button element's "disabled" attribute, but it doesn't seem to be working. The callback fires on change, but event.oldValue is always null and event.newValue is always undefined. The workaround is to get the actual attribute value using $(selector).attr('disabled') within the callback. Can you fix this bug so event.oldValue and event.newValue return correct values for the "disabled" attribute?