HI WELCOME TO KANSIRIS

How to get values of each input field using jquery having same name?

Leave a Comment
Input field 1:
<input type="text" maxlength="255" name="amount[]" >
Input field 2:
<input type="text" maxlength="255" name="amount[]" >
and so on....the number of fields are variable.
Now I want to get the values the user typed in each of the field that is named . 
Since there are multiple element with same name you need indexing:
$("input[name='amount[]']")[0].value;
and for getting all elements values:
$("input[name='amount[]']").each(function (i,v) {
    alert(this.value);
});

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.