Bug Tracker

Ticket #10115 (closed bug: invalid)

Opened 3 years ago

Last modified 20 months ago

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:
Blocking: Blocked by:

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.

Change History

comment:1 Changed 3 years ago by dmethvin

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

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/

comment:2 Changed 20 months 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 20 months 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.