So I have 2 inputs. Both are for an "autocomplete". I also have 2 functions that do pretty much the same thing... Each input calls a different function onBlur. The problem is that the second upon selecting a "suggestion" for the second input, it populates the first. What can I do to make the second one populate the second?
There's probably a better way of doing it but my jQuery/Javascript Knowledge is limited and I'm running out of time... Thanks!
The code:
function fillLocation(thisValue) {
$('#location-box').val(thisValue);
setTimeout("$('#suggestionsLocation').fadeOut('fast');", 200);
}
function fillTerms(thisValue) {
$('#terms-box').val(thisValue);
setTimeout("$('#suggestionsTerms').fadeOut('fast');", 200);
}
<input type="text" name="search_location" id="location-box" value="" onkeyup="suggestLocation(this.value);" onblur="fillLocation();" autocomplete="off" />
<input type="text" name="search_terms" id="terms-box" value="" onkeyup="suggestTerms(this.value);" onblur="fillTerms();" autocomplete="off" />