Bug Tracker

Opened 14 years ago

Closed 11 years ago

#4013 closed bug (fixed)

: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:


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.

Change History (8)

comment:1 Changed 14 years ago by dz

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.

comment:2 Changed 14 years ago by krallja

Thanks, dz. I will do that.

comment:3 Changed 14 years ago by Qazzian

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')

comment:4 Changed 13 years ago by snover

#6591 is a duplicate of this ticket.

comment:5 Changed 13 years ago by snover

Priority: majorhigh
Status: newopen

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.

comment:6 Changed 12 years ago by dmethvin

Priority: highlow

Confirmed in bug triage.

comment:8 Changed 11 years ago by Timmy Willison

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.