Bug Tracker

Ticket #9485 (closed bug: worksforme)

Opened 3 years ago

Last modified 21 months ago

Using the prop method to set disabled fails in Chrome

Reported by: cscott@… Owned by:
Priority: low Milestone: 1.next
Component: attributes Version: 1.6.1
Keywords: Cc:
Blocking: Blocked by:

Description

I have a site where I select multiple objects and set the prop('disable', true). This works fine in FF3.6 but fails in Chrome 11.

Here's my sample code:

$('#id').find('button').prop('disabled', true); this fails $('#id').find('button').attr('disabled', true); this works

<div id='id'>

<p>data</p> <div>

<button>Button1</button> <button>Button2</button>

</div>

</div>

Change History

comment:1 follow-up: ↓ 7 Changed 3 years ago by timmywil

  • Priority changed from undecided to low
  • Resolution set to worksforme
  • Status changed from new to closed
  • Component changed from unfiled to attributes

comment:2 Changed 3 years ago by dmethvin

Confirmed working on Chrome 11.0.696.71 (Windows 7)

comment:3 Changed 3 years ago by cscott@…

I guess I didn't explain enough. I have a tool that toggles the state of the property, so it sets it and then removes it. It will not work after removing the property. Please see:  http://jsfiddle.net/Ahx3D/

comment:4 Changed 3 years ago by cscott@…

Also I am using Chrome 11 in Ubuntu 10.10

comment:5 Changed 3 years ago by timmywil

From the docs:

"Note: Do not use [removeProp] 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:6 Changed 3 years ago by cscott@…

Then the error exists in FF3.6 because it DOES work.

comment:7 in reply to: ↑ 1 Changed 21 months ago by anonymous

Replying to timmywil:

Works fine for me:  http://jsfiddle.net/timmywil/4hjWu/

It does not work (in Chrome) after using removeProp():

 http://jsfiddle.net/4hjWu/34/

comment:8 Changed 21 months ago by timmywil

@anonymous: see the above note from the removeProp docs. Do not use removeProp for that.

Note: See TracTickets for help on using tickets.