Question: I am trying to get the values of each of the input field that are under same set. Below is my code:

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 . How to do that in jquery?

I have tried following code but it returns nothing:

```
$("input[name=amount[]]").val();

```

Answer: 
you can get all values in an array

```
var values = $('input[name="amount[]"]').map(function(){
   return this.value;
}).get();

console.log(values);

```

Demo `--->` <http://jsfiddle.net/BFjp5/>
```
$("input[name='amount[]']")

```

This will get you a set of elements. You can get value of each of those elements by iterating over them.

```
$("input[name='amount[]']").each(function(){
    $(this).val();
});

```