Knowledge of JS at the student level. Can you please tell me how to transfer the link name to a text form?
More detailed description:
The form:
References:
Name1
Name2
Name3
It is necessary that when you click on a specific link, its name was placed in the form.

    1 answer 1

    var links = document.querySelectorAll('.link'), input = document.querySelector('.textInput'); for (var i = 0; i < links.length; i++) { links[i].addEventListener('click', function() { input.value = this.innerText; return false; }, false); } 
     a, input { display: block; } 
     <a href="#" class="link">Link 1</a> <a href="#" class="link">Link 2</a> <a href="#" class="link">Link 3</a> <input type="text" class="textInput" />