function formatItem(theObject, itenNum, itemTotal, itemStr, searchStr){ return itemStr; } function highlight(itemStr, searchStr){ // Strip "near:" and any surrounding white space from the beginning of the search string. searchStr = searchStr.replace(/^\s*near:\s*/, ''); // Replace any instances of the search string in the item string with a bolded version. var regex = eval('/('+searchStr+')/gi'); return itemStr.replace(regex, '$1'); } $().ready(function() { var suggestionObj = { // http://docs.jquery.com/Plugins/Autocomplete/autocomplete#toptions cacheLength: 0, // delay: 400, formatItem: formatItem, highlight: highlight, matchSubset: 0, matchCase: 0, matchContains: 0, max: 8, minChars: 1, scroll: 1, scrollHeight: 300, selectFirst: 0, width: '295px' // width: parseInt($("#location").width()) + 'px', } $("#query").autocomplete("g/sgstTopic.php", suggestionObj); $("#location").autocomplete("g/sgstLoc.php", suggestionObj); $("#search-q").autocomplete("g/sgstTopic.php", suggestionObj); $("#search-l").autocomplete("g/sgstLoc.php", suggestionObj); $('#query').clearableTextField(); $("#location").clearableTextField(); $('#search-q').clearableTextField(); $("#search-l").clearableTextField(); // $('input[type=text]').clearableTextField(); });