Reputation: 58
I have an HTML5 datalist
that contains about 4,000 records and I need to be able to search based on the innerText of the option value.
<input list="browsers" name="browser">
<datalist id="browsers">
<option value="Internet Explorer">IE - Worst Browser</option>
<option value="Firefox">FF - Was cool</option>
<option value="Chrome">Google - It just works</option>
</datalist>
The goal is that when I search for example Worst I get the options back with that substring. And when they click on the option It gets populated with the value (Which it is already doing for me nicely).
tl;dr is there anyway to set the search possible search terms for each <option>
Thanks so much.
Upvotes: 1
Views: 724
Reputation: 149
Data list’s Basic functionality is to enter your own value or to choose from bounded values. In order to manipulate its behavior you should manipulate DOM. This may help! Search HTML5 Datalist by Value and inner text (or some other property)
Upvotes: 1