jquery - Html SELECT : send both value and text on submit -


i have select

<select name="country" multiple>     <option value="in">india</option>     <option value="us">united states</option> </select> 

while submitting form if both country selected, default behaviour is, send as:

country=in,country=us 

but want send both value , text i.e in , india both. how can done

i think should give try:

$("#btnsub").on('click',function(){ // submit button click   $(".select option:selected").each(function(i, option){     console.log($(this).val() + "," + $(this).text());   });     return false; }); 

html

<select class="select" name="country" multiple="multiple"> </select> 

fiddle demo


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -