I need to pass some text into a hidden input when certain part of the page are clicked.
The simplest version of this (with input="text" to check if it works) would look like this :
function myFunct(the_text) {
document.getElementById('id01').value = the_text;
return;
}
<input type="text" id="id01" value="write here" />
<a href="#" onclick( "myFunct("this text should go on the box ");"); /> click me </a>
</br>
<a href="#" onclick( "myFunct("or this one ");"); /> No! Click me </a>
</br>
I don't know how to properly pass the string as the parameter of the function.