So I have this form
<form> <div> <span class="form_t">I Want To Trade In <span id="trade_target"></span> </span> <span class="form_t">With</span> <div class="selecting"> <select> <option>A Mac</option> <option>An Iphone</option> </select> </div> </div> <table id="tradein_table"> <tr> <td class="textside">My contact Info</td> </tr> <tr> <td class="textside">Mobile Number</td> <td class="inputside"><input type="text" name="Mobile" id="t_mobile"/></td> </tr> <tr> <td class="textside">First Name</td> <td class="inputside"><input type="text" id="t_first" name="Fname"/></td> </tr> <tr> <td class="textside">Last Name</td> <td class="inputside"><input type="text" id="t_last" name="Lname"/></td> </tr> <tr> <td class="textside">Email</td> <td class="inputside"><input type="text" id="t_email" name="Email"/></td> </tr> <tr> <td class="textside">Company</td> <td class="inputside"><input id="t_company" type="text" name="Company"/> </td> </tr> </table> <div class="submit_div"> <input class="submit_form" type="submit" name="Submit" value="Submit" /> </div> </form>
And when I run it through jQuery serialize()
it picks up all the tags except the select tag in the div.
Any ideas how to get it as well ?
serialize
only "picks up" elements with name
attribute.
<select name="foo"> <option>A Mac</option> <option>An Iphone</option> </select>
Your's:
<select> <option>A Mac</option> <option>An Iphone</option> </select>
Won't work.
For a form element's value to be included in the serialized string, the element must have a name attribute.
docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With