jquery autocomplete highlighting

Viewed 10854

How can I make my jquery autocomplete highlight what the user is typing in in any autocompleted results? The code I am using is:

    $("#keyword").autocomplete({ 
        source: "ajax/autocomplete.php?action=keyword", 
        minLength: 2 
    });

Tried this implemented from the link tomasz posted:

    $("#keyword").autocomplete({ 
        source: "ajax/autocomplete.php?action=keyword", 
        highlight: function(value, term) { 
    return value.replace(new RegExp("("+term+")", "gi"),'<b>$1</b>'); 
    },
        minLength: 2 
    });

No luck there either. jQuery autocomplete seems to hate me.

Update: Thanks to David Murdoch, I now have an answer! See @Herman's copy of the answer below.

2 Answers
Related