Skip to main content

Bug Tracker

Side navigation

#4013 closed bug (fixed)

Opened January 28, 2009 06:33PM UTC

Closed May 29, 2012 12:10AM UTC

:enabled no longer finds hidden elements

Reported by: krallja Owned by: john
Priority: low Milestone: 1.next
Component: selector Version: 1.4.4rc
Keywords: Cc:
Blocked by: Blocking:
Description

A form element with <item type="hidden"> will POST with those hidden elements as request variables. Filtering on $(":enabled", theForm) will only find VISIBLE enabled elements, which is changed since jQuery 1.2.6. There is now no easy way to serialize a form in the same manner that the browser would submit it.

Attachments (0)
Change History (8)

Changed January 29, 2009 02:39AM UTC by dz comment:1

From the jQuery 1.3.1 source:

enabled: function(elem){
  return elem.disabled === false && elem.type !== "hidden";
},

So it looks intentional. If you have questions about the behavior, and if you want to inquire about reverting it to 1.2.6 behavior or for possible alternates, try emailing the jquery-dev mailing list.

Changed January 29, 2009 06:49PM UTC by krallja comment:2

Thanks, dz. I will do that.

Changed June 18, 2009 05:05PM UTC by Qazzian comment:3

For info the discussion is here:

http://groups.google.com/group/jquery-dev/browse_thread/thread/20f145cc3e48bb43/1fbb78d0a65b9227

Result is that this behaviour is consistent with browser implementations of querySelectorAll()

The documentation needs to be updated at it is not clear.

The best way to get all enabled inputs including type=hidden is to use .not(':disabled')

Changed November 09, 2010 07:55AM UTC by snover comment:4

#6591 is a duplicate of this ticket.

Changed November 09, 2010 08:05AM UTC by snover comment:5

milestone: 1.3.21.4.5
priority: majorhigh
status: newopen
version: 1.3.11.4.4rc

Sizzle is doing this wrong. No current browsers implement this pseudo-selector the way it does. test case

In browsers that support qSA the results are correct. In browsers that do not support qSA (IE7), $(':enabled') returns 13 and $('input:enabled') returns 0. They should both return 1.

Changed July 11, 2011 06:17PM UTC by dmethvin comment:6

priority: highlow

Confirmed in bug triage.

Changed July 11, 2011 06:32PM UTC by cowboy comment:7

Changed May 29, 2012 12:10AM UTC by timmywil comment:8

resolution: → fixed
status: openclosed