Bug Tracker

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#10115 closed bug (invalid)

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:


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.

Change History (3)

comment:1 Changed 5 years ago by dmethvin

  • Resolution set to invalid
  • Status changed from new to closed

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.


comment:2 Changed 4 years ago by anonymous

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

comment:3 Changed 4 years ago by anonymous

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

Note: See TracTickets for help on using tickets.