Actually, I have more than 8-inputs w/ 8 different id's in HTML & i wanted to pass the jquery objects to a onlblur event function so I don't need to create 8-repetitive functions & only make 1 script function. I've been trying really hard for hours in searching Stack overflow but couldn't find the answer to my questions or perhaps I am just new to jquery. Hope you can help me & thanks in advance...
function fill(t,xx,zz) {
$(xx).val(t);
setTimeout("$(zz).hide();", 200);
}
<input type="text" id="inputString" size="50" value="" onkeyup="lookup(this.value);" onblur="fill(this.value,'#inputString','#suggestions');" />
<div class="suggestionsBox" id="suggestions" style="display: none;">
To give you a better understanding of the code, this it the original one that really works & is only good for 1-input html tag. I'm planning to use only ONE function on 8-input html tags.
<script type="text/javascript" src="jquery-1.2.1.pack.js"></script>
function lookup(xString) {
if(xString.length == 0) {
// Hide the suggestion box.
$('#suggestions').hide();
} else {
$.post("db_rpc.php", {queryString: ""+xString+""}, function(data){
if(data.length >0) {
$('#suggestions').show();
$('#autoSuggestionsList').html(data);
}
});
}
} // lookup
function fill(t) {
$('#inputString').val(t);
setTimeout("$('#suggestions').hide();", 200);
}