jQuery event when HTML5 Datalist option is clicked

↘锁芯ラ 提交于 2019-11-29 03:08:33

Use the input event instead of the other events. It's actually designed to cover what you want:

$("#name").bind('input', function () {
    window.checkModelData(this);
});

I made a jsfiddle for you to try it out.

You can also listen to the 'select' event on the input field.

$('#name').bind('select', function() {
    // handle input value change
});

To handle click only event here is the solution.

$("#book_search").bind('select', function () {
    alert("changed");   
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!