Today I have a problem. I have a HTML Form, which can have a dynamic number of HTML Input Fields for an EMail Address. Via Javascript I want to evaluate those Data ans Post via XMLHttpRequest. 

I fetch the Input fields like this:

```
var elements = document.getElementById("emailmodal").elements["multiple[]"];

```

Then I want to check, if it is an array, because if I have only one input field elements will not contain an array of elements, but only one element:

```
if(jQuery.isArray(elements))
{

    for(var i = 0; i < elements.length; i++)
    {

        formData.append("emailreceiver[]", elements[i].value);

    }

}else
{

    formData.append("emailreceiver[]", elements.value);

}

```

In case it is an Array, it is going through the Elements via For Loop, and if not, its directly taking the value.

However this doesnt work correctly. Even if I have multiple INputs, the Script tells me, its no array. 

The Corresponding HTML is

```html
<div class="form-group input-group">
<input type="text" name="multiple[]" class="form-control" value="<?php echo $kundendaten['Email']; ?>">
<span class="input-group-btn"><button type="button" class="btn btn-default btn-add">+</button></span>
</div>
```

This is from Bootstrap.

If i make var log to console and I have more then one element than it looks like this:
[![enter image description here](https://i.stack.imgur.com/Di62K.png)](https://i.stack.imgur.com/Di62K.png)

If I make var log and only have one element it looks like this

[![enter image description here](https://i.stack.imgur.com/hJR4X.png)](https://i.stack.imgur.com/hJR4X.png)

What can I do?

Cheers,
Niklas