Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery autocomplete with multiple keywords, highlighting and partial matches
    primarykey
    data
    text
    <p>I'm on the hunt for a JQuery autocomplete that will:</p> <ul> <li>Search partial matches</li> <li>Highlight all occurrences whereever they appear</li> <li>Allow multiple word</li> <li>Allow remote datasources (i.e. PHP filters database results based on querystring that dynamically updates with each keypress)</li> </ul> <p>So for example</p> <p>Search: "me wa home"</p> <p>Returns: "show <strong>me</strong> the <strong>wa</strong> y to go <strong>home</strong>"</p> <p>I'm having a terrible time trying to find something that can offer this, even though it is common expectation of a Google-style autocomplete.</p> <p>The monkeypatch of jquery ui autocomplete ( <a href="https://stackoverflow.com/questions/2435964/jqueryui-how-can-i-custom-format-the-autocomplete-plug-in-results">jQueryUI: how can I custom-format the Autocomplete plug-in results?</a> ) comes close, but doesn't seem to offer dynamic remote datasources.</p> <p>I've also come close with the following script:</p> <pre><code>var termTemplate = "&lt;span class='ui-autocomplete-term'&gt;%s&lt;/span&gt;"; $("#f input").autocomplete({ source: "livesearch.php", open: function(e, ui) { var origKeyword = $("#f input").val(); var acData = $(this).data('autocomplete'); acData.menu.element.find('a').each(function() { var me = $(this); var regex = new RegExp(acData.term, "gi"); me.html(me.text().replace(regex, function(matched) { return termTemplate.replace('%s', matched); })); }); }, select: function(event, ui) { var keyword = $("#f input").val(); $("#f input").val(''); window.location.href = 'MYURLHERE?VARIABLE=' + ui.item.value; return false; }, focus: function(event, ui) { return false; } }); </code></pre> <p>However, it doesn't handle highlighting multiple words separated by a space.</p> <p>if anyone has any suggestions, I'd be hugely grateful.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload