/ Published in: jQuery

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!-- HTML --> <input type="text" id="input-text-4" size="40"/> <ul id="values"> <li>Smashing Magazine</li> <li>Woork Up</li> <li>Mashable</li> </ul> //JavaScript $("ul[id='values'] li").click(function suggestValues(){ input = $("input[id='input-text-4']"); el = $(this).html(); $(this).remove(); newinput = input.val(); newinput = (newinput + el + ", "); input.val(newinput); });
URL: http://woorkup.com/2009/10/14/jquery-lessons-how-to-interact-with-html-forms/
Comments
