I’m trying to build a search box for a select list, and I’m looking for some suggestions on doing this with jQuery. My goal is to hightlight <option/>‘s that contain the search string or hide all <option/>‘s that don’t. I thought I was on to something with attribute selectors until I realized that I’m searching on the HTML content and not an attribute.
<select name="Users" id="Users">
<option value="123">Frank Smith (fsmith@example.com)</option>
<option value="456">Joe Banks (jbanks@example.com)</option>
</select>
Have a look at the contains() selector http://api.jquery.com/contains-selector/