Reputation: 436
I have a massive select with all the books of the bible listed, then attached an AJAX request being sent out for a PHP script. I want users to be able to type in the first couple of letters of the desired book, and the browser is currently looking for a value that has been changed to a number. Such as:
<option value="1" onchange="change_book();">Genesis</option>
How do I either A) Have JavaScript look for another, unique value or B) have the browser render something else I'm not aware of?
Upvotes: 0
Views: 30
Reputation: 31644
First off, you can't bind an onchange
event to an <option>
tag because those don't change. <select>
does.
Second, you mention typing. It sounds like you want something like autocomplete
Upvotes: 1
Reputation: 14136
Have a look at the Select2 select box library, specifically Loading Remote Data
Upvotes: 0