Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to get value of multiple input using name as follows

<input type="select" name="gethere[]" value="11"/>
<input type="select" name="gethere[]" value="22"/>
<input type="select" name="gethere[]" value="33"/>


how to get of all in jquery in each using name attributes
Posted
Comments
Nick Fisher (Consultant) 27-Dec-13 4:32am    
The whole point of the name attribute is that it's supposed to be unique, so you have a way of differentiating between each of your input elements. If your input elements don't have a unique name, how are you supposed to reference each one directly?
maulikshah1990 27-Dec-13 4:36am    
i want to use multiple same name input text values ..that is reason i m using same name for multiple input ... so in <input type="select" name="gethere[]" value="11"/>
<input type="select" name="gethere[]" value="22"/>
<input type="select" name="gethere[]" value="33"/>

if i want all above values, how to get that...u suggest

1 solution

Your code does not make sense, see my demo code below:
XML
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("#getSelectedValue").click(function(){
    $('#multiselect :selected').each(function(i, selected) {
       alert($(selected).val());
    });
  });
});
</script>
</head>
<body>
<select id="multiselect" multiple>
   <option value="11">11</option>
   <option value="22">22</option>
   <option value="33">33</option>
</select>
<br><br>
<input type="button" id="getSelectedValue" value="Show Selected Values" >
</body>
</html>

Suggest you read out on the following topics:
HTML[^]
JavaScript[^]
jQuery[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900