html - jQuery Select array not working -


html code:

<select name="code[]">     <option value="1">1</option>     <option value="2">2</option>     <option value="3">3</option> </select> <select name="code[]">     <option value="1">1</option>     <option value="2">2</option>     <option value="3">3</option> </select> <select name="code[]">     <option value="1">1</option>     <option value="2">2</option>     <option value="3">3</option> </select> 

jquery code:

var codes = $("input[name='code[]']").serializearray(); alert(codes); 

alert empty why happening selected value in select box. still, empty can please me. how can resolve error?

the selector trying find inputs.. should change select.

var codes = $("select[name='code[]']").serializearray(); 

https://jsfiddle.net/3qdbkx36/


Comments

Popular posts from this blog

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -