Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#9485 closed bug (worksforme)

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

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 (8)

comment:1 Changed 12 years ago by Timmy Willison

Component: unfiledattributes
Priority: undecidedlow
Resolution: worksforme
Status: newclosed

comment:2 Changed 12 years ago by dmethvin

Confirmed working on Chrome 11.0.696.71 (Windows 7)

comment:3 Changed 12 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 12 years ago by cscott@…

Also I am using Chrome 11 in Ubuntu 10.10

comment:5 Changed 12 years ago by Timmy Willison

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 12 years ago by cscott@…

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

comment:7 in reply to:  1 Changed 10 years 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 10 years ago by Timmy Willison

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

Note: See TracTickets for help on using tickets.