Question

I have 2 selects with same names. One is displayed, and the other is hidden.

<select name="city" style="display: none;">
    <option value="notSend">foo</option>
</select>

<select name="city">
    <option value="send">foo</option>
</select>

How can I send only select, which are displayed?

Was it helpful?

Solution

You can use HTML disabled attribute to disable <select> and hide that element using Jquery hide method

Example: http://jsfiddle.net/zZTMd/

Note: Don't forget to include JQuery library file

OTHER TIPS

Disable the code which should not be send.

Disable the HTML like this without removing the code:

 <!--select name="city" style="display: none;">
 <option value="notSend">foo</option>
 </select-->

 <select name="city">
 <option value="send">foo</option>
 </select>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top