Reputation: 9292
I'm trying to use the $(':input')
selector but it's not selecting disabled ones, nor hidden ones.
$(':input').serialize()
Although the form tag is enclosing everything, it just serialize a few ones because other parts are in other divs and that seems to broke the form.
Is there anyway to select all inputs including hidden and disabled ones?
I know I could do it by selecting manually by each field's ID but it's not the best approach IMO.
Upvotes: 1
Views: 198
Reputation: 75317
The problem is not that the :input
selector isn't targeting disabled inputs, it's that the serialize()
method does not serialize disabled inputs.
The serialize()
documentation states;
Note: Only "successful controls" are serialized to the string.
The link goes on to explain that; Controls that are disabled cannot be successful..
Hidden input fields should be both selected by the :input
selector, and serialized by the serialize()
method; which is what this JSFiddle shows; http://jsfiddle.net/H2g6Q/
Upvotes: 2