Skip to main content

Bug Tracker

Side navigation

#10115 closed bug (invalid)

Opened August 22, 2011 08:03PM UTC

Closed August 22, 2011 11:08PM UTC

Last modified February 14, 2013 09:13AM UTC

prop('disabled') and removeProp('disabled') on select elements not working as expected.

Reported by: markstory Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:
Description

With jQuery 1.6.2, using prop() and removeProp() to toggle the disabled property on a select box in Chrome 14.0.835.94 beta does not work as expected.

The first toggling of disabled works as expected, but future toggling does not. This might be me confusing how these methods work. However, the equivalent code without jQuery doesn't suffer the same issue.

The same issue is not present in Safari 5.0.5 or Firefox 6.0

I've created a fiddle for the issue http://jsfiddle.net/markstory/B3NCY/

To reproduce try toggling the enabled/disabled links several times.

Attachments (0)
Change History (3)

Changed August 22, 2011 11:08PM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed
Note: Do not use this method to remove native properties such as checked, disabled, or selected. This will remove the property completely and, once removed, cannot be added again to element. Use .prop() to set these properties to false instead.

http://api.jquery.com/removeProp/

Changed February 14, 2013 09:08AM UTC by anonymous comment:2

Setting "disabled" to "false" using prop does not work in some browsers (on my IE 9.0.8), since they follow a standard of if a "disabled" attribute is defined, it's equivalent to true (irrelevant of "disabled"s value).

So only way to enabled it would be to remove it

Changed February 14, 2013 09:13AM UTC by anonymous comment:3

Scrap that last comment, prop('disabled', false) is clever enough to remove the disabled attribute, not just set it to false