How do I get the change event for a datalist?

前端 未结 6 690
轮回少年
轮回少年 2021-02-05 11:14

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 wh

6条回答
  •  南方客
    南方客 (楼主)
    2021-02-05 12:04

    Please have look for your solution it's good to go. Have look for Demo

    $(document).on('change', 'input', function(){
        var optionslist = $('datalist')[0].options;
        var value = $(this).val();
        for (var x=0;x
    
    
    
         
        
    

提交回复
热议问题