Trigger the event when selected the same value in dropdown?

后端 未结 5 609
予麋鹿
予麋鹿 2021-01-14 18:52

Issue: I have a dropdown with a list of years in it with nothing selected, the user selects \"1976\", I run a function. If the user clicks on the dropdown again and selects

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-14 19:17

    mouseup event should do the trick:

    $('select').mouseup(function(){
        console.log("hue");
    });
    

    http://jsfiddle.net/5Fcgr/

    note that this will be triggered twice when a new value is selected in the listbox. Once when opening the options, and once when selecting an option.

提交回复
热议问题