Hey I'm trying to return a message when there are no results for the users current query! I have looked all over the net and there are similar scenarios, but I can't seem to get it working with my code below! Can anyone help me figure this out please, as I am pulling my hair out trying to fix it!
I need to maintain the ability to use the keyboard to scroll down through the results.
Thanks in advance.
HTML
<div id="search_box"> <form id="search_form" autocomplete="off" action="" onSubmit="return false;"> <input type="text" id="suggestSearchBox" value="Search by City or Hotel Name" onClick="this.value='';" /> </form> </div>
Javascript NOTE: The remote data source is called "dataLocCodes", which is a javascript array
// JavaScript Document $(function() { $("#suggestSearchBox").focus().autocomplete(dataLocCodes, { max: 15, selectFirst: true, matchContains: true, formatItem: function(row, i, max){ if (row.hotelId) { return row.accomName + ' - ' + row.city + ' - ' + row.country; } else { return row.city + ' - ' + row.country; } } }).result( function(event, row, formatted) { $("input#suggestSearchBox").val(row.city + ' - ' + row.country); var param = row.locparam; var encoded_url = param.replace(/ /gi,"+"); encoded_url = encoded_url.replace(/&/gi,"amp"); window.location.href = "hotels.html?location=" + encoded_url; }); });