Skip to main content

Bug Tracker

Side navigation

#9485 closed bug (worksforme)

Opened June 01, 2011 08:24PM UTC

Closed June 01, 2011 08:56PM UTC

Last modified December 17, 2012 06:55PM UTC

Using the prop method to set disabled fails in Chrome

Reported by: cscott@ttitech.net 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>

Attachments (0)
Change History (8)

Changed June 01, 2011 08:56PM UTC by timmywil comment:1

component: unfiledattributes
priority: undecidedlow
resolution: → worksforme
status: newclosed

Changed June 01, 2011 09:02PM UTC by dmethvin comment:2

Confirmed working on Chrome 11.0.696.71 (Windows 7)

Changed June 01, 2011 09:15PM UTC by cscott@ttitech.net comment:3

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/

Changed June 01, 2011 09:16PM UTC by cscott@ttitech.net comment:4

Also I am using Chrome 11 in Ubuntu 10.10

Changed June 01, 2011 09:44PM UTC by timmywil comment:5

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."

Changed June 02, 2011 09:03PM UTC by cscott@ttitech.net comment:6

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

Changed December 17, 2012 09:51AM UTC by anonymous comment:7

Replying to [comment:1 timmywil]:

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

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

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

Changed December 17, 2012 06:55PM UTC by timmywil comment:8

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