I have two elements:
<input type="text" name="pmTo" id="pmTo" onkeyup="offerSuggs('none');" onfocus="showSelect();" onblur="hideSelect();" />
and a dynamically created one (this is all part of an auto suggest program):
$suggString .= '<div name="'.$value.'" id="'.$value.'" class="suggMouseOver" onmouseover="highlightDivs(this);" onmouseout="blurDivs(this);" onclick="fillInput(this);">'.$value.'</div>';
Okay, and then there are the event functions that correspond to the onblur
of the input element and then the onclick
of the div element:
function hideSelect() {
offerSuggs('checkFinal');
document.getElementById('nameSugg').style.display="none";
}
function fillInput(elemName) {
document.getElementById('pmTo').value=elemName.id;
}
EDIT: How do I get the onclick
to trigger correctly on the element they click on without the onblur
event hiding the div first which makes the onclick
meaningless? I would still like to retain the functionality of the suggestion div disappearing when the textbox loses focus, however.