문제

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?

도움이 되었습니까?

해결책

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

다른 팁

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top