Jörn,

>> I'd like to see both a highlight: true/false and onHighligh: function(){}
>> option. That would provide tons of flexibility.
>>
>How about this:
>@option Boolean|Function highlight Whether and how to highlight matches
>in the select box. Set to false to disable. Set to a function to
>customize. Default: Wraps the search term in a <strong> element

That would work. My nature is to break the 2 into separate options--only
because I think it's confusing to novice users. But that definitely would
work.

Also, I think maybe you could fix the HTML issue by changing your function
to:

function highlight(value) {
        return value.replace(new RegExp("(?<!<[^<>]*)(" + term + ")", "gi"),
"$1<strong>$2</strong>");
}

I did not test this yet. You might want to throw it at some HTML. And test
it. 

There's also some other suggestions here:
http://regexadvice.com/forums/thread/24779.aspx

-Dan

Reply via email to