Can anyone help with how do you get the different innerhtml from the same class into an input text? This is the code. Thanks.
function myFunction() {
  var a = document.getElementsByClassName("name");
  var b = document.getElementById("whispering");
  a.innerHTML = b.value;
}<span onclick="myFunction();" class="name" id="username1"> Username 1 </span>
<span onclick="myFunction();" class="name" id="username2"> Username 2 </span>
<input type="text" id="whispering"> 
     
     
    