lets say we got this html scenario:
Please note:
The forms "action" and "method" attributes are omitted on purpose. The "form" tag is just here because in my real project, I have a similar scenario and having the form around all those fields may help in handling the request.
<form id="form1">
<div id="wrapperDiv">
<div id="div1">
<input type="text" id="searchField"/>
</div>
<div id="div2">
<ul>
<li><a href="javascript:void(0)" onclick="callFunction(this);">Hello</a></li>
</ul>
</div>
</div>
</form>
<script type="text/javascript">
function callFunction(x)
{
//When invoked this function sets the value of "searchField" to the respective link tag innerHTML
//to set this you cant use something like:
// var y = document.getElementById("searchField");
}
</script>