change all elements with a certain class based on text input

I think this is going to be something very simple but I haven’t found an answer. How would I make all span elements with class="namehere" display what was inserted in input text?

function start() {
  var name = document.getElementById("name").value;
  document.getElementByClassName("namehere").innerHTML = name;
}
<input id="name" type="text" value="Type name here">
<button type="button" onclick="start()">start</button>
<br>
<br>
<span class="namehere"></span> is doing this and that.
<br>
<span class="namehere"></span> wants to do this and that.
<br>
<span class="namehere"></span> is not doing this or that.
<br>
<span class="namehere"></span> wants to do this but instead is doing that.

solution

The method getElementsByClassName() returns an array-like object of elements.

You need to iterate over each element and access it by its index.

Working Example

var nameElements = document.getElementsByClassName('namehere');
for (var i = 0; i < nameElements.length; i++) {
  nameElements[i].textContent = document.getElementById('name').value;
}

or:

var nameElements = document.getElementsByClassName('namehere');
Array.prototype.forEach.call(nameElements, function (el) {
  el.textContent = document.getElementById('name').value;
});