Hello,
I'm building an intranet site for work with an autocomplete feature. I have it working to where when the user clicks on the name in the autocomplete list, it will fill that value to the text input box. What I need it to do is after it fills in the value, also submit the form, à la Google. I know I have to use document.formname.submit
, but I can't get it to do both, all I can get is one or the other. I would usually research how to do this, but I'm on a tight schedule and really need your help! Here's what I have for the code so far.
function suggest(a) {
if (a.length == 0) {
$("#suggestions").fadeOut()
} else {
$("#search").addClass("load");
$.post("autosuggest.php", {
queryString: "" + a + ""
},
function (b) {
if (b.length > 0) {
$("#suggestions").fadeIn();
$("#suggestionsList").html(b);
$("#search").removeClass("load")
}
})
}
}
function fill(a) {
$("#search").val(a);
setTimeout("$('#suggestions').fadeOut();", 300)
};