Hello there, I have an input and an auto-sugest div. This is the javascript code: function handleSearchSuggest() { if (http.readyState == 4) { var ss = document.getElementById('search_suggest') ss.innerHTML = ''; var str = http.responseText.split("\n"); for(i=0; i < str.length - 1; i++) { //Build our element string. This is cleaner using the DOM, but //IE doesn't support dynamically added attributes. var suggest = '<div onmouseover="javascript:suggestOver(this);" '; suggest += 'onmouseout="javascript:suggestOut(this);" '; suggest += 'onclick="javascript:setSearch(this.innerHTML);" '; suggest += 'class="suggest_link">' + str[i] + '</div>'; ss.innerHTML += suggest; } } } //Mouse over function function suggestOver(div_value) { div_value.className = 'suggest_link_over'; } //Mouse out function function suggestOut(div_value) { div_value.className = 'suggest_link'; } //Click function function setSearch(value) { document.getElementById('txtSearch').value = value; document.getElementById('search_suggest').innerHTML = ''; } Code (markup): And this is the PHP code: if(isset($_GET['value']) && $_GET['value'] != '') { $search = addslashes($_GET['value']); $suggest_query = "SELECT distinct(name) as suggest, id as id FROM cards WHERE name like('" . $search . "%') ORDER BY name"; $suggest_query = mysql_query($suggest_query) or die(mysql_error()); while($suggest = mysql_fetch_array($suggest_query)) { //Return each page title seperated by a newline. //$link = " <a href=\"?act=edit-card&id=".$suggest['id']."\">link</a> \n"; echo $suggest['suggest'] ."\n"; } } PHP: I tried with succes to add that link next to the name. It looked ok. When I clicked the link it took me where it should, however, when I click the DIV, the input supose to populate with the clicked div name. However, now because I also have the link, I also get the NAME + LINK in the input. Something like: NAME <a href=...... On click I only want the NAME to be put on the input. On show I want the NAME + the link I can't find a way to IGNORE the link and only put the name on the input when clicked. Any sugestions please? Thanks