Search code examples
htmlinputsend

How to disable one of 2 input with same names


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?


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