141
rated 0 times
[
143]
[
2]
/ answers: 1 / hits: 44207
/ 10 Years ago, wed, may 14, 2014, 12:00:00
I am using a datalist and need to detect when the user selects something from the drop-down list. A similar question has been asked BUT I need it so that the event fires ONLY when the user selects something from the datalist. If they type something in the input then I do NOT want the event to fire. (Notice in the accepted answer to the question I linked that they bind the input, which is not what I want). I've tried (with no success):
<datalist>
<option>Option 1 Here</option>
<option>Option 2 Here</option>
</datalist>
$(document).on('change', 'datalist', function(){
alert('hi');
});
EDIT:
This question is different than the suggested question because it's a completely different question.
More From » jquery