PDA

View Full Version : Load input field using a link?



jughead47
02-16-2015, 07:51 PM
Is there a way to load an input field using a link?

So a search box is blank, but if the user clicks a link "Hello" the search box input field will then be loaded with the term "Hello".

molendijk
02-16-2015, 08:38 PM
Try this:

<form>
<input type="text" id="input_field" onclick="reset()">
</form>

<a href="javascript: void()" onclick="document.getElementById('input_field').value=this.innerHTML; return false">Hello</a>

jughead47
02-17-2015, 01:18 PM
Thank you!!!