get multiple ids javascript code example
Example 1: get element by id two ids
`getElementById()` should only ever return one element. You can not make it return multiple elements
Example 2: javascript get multiple elements by id
<!-- html -->
<a class="test" name="Name 1"></a>
<a class="test" name="Name 2"></a>
<a class="test" name="Name 3"></a>
var elements = document.getElementsByClassName("test");
var names = '';
for(var i=0; i<elements.length; i++) {
names += elements[i].name;
}
document.write(names);