Hello,
I have written a 'predictive text' widget using JavaScript/AJAX. When user enters a string of letters into form, the list of possible matches is displayed under the form. This works well and good, now I am trying to make it so that when the user clicks on a certain word, the form input filed is populated with that word. I have tried like this:
in my HTML file:
<form>
<input id="foo" type="text" />
</form>
<div id="bar" onClick="populate(this.value);">
</div>
And, in JavaScript, I have:
function populate (baz) {
document.getElementById('foo').innerHTML = word;
}
But this is not working. Any suggestions?