JQuery detect dropdown value is selected even if it's not changed

前端 未结 7 1764
感动是毒
感动是毒 2021-01-05 01:29

Using JQuery or JavaScript, I want to detect when a user selects a value, even if they don\'t change the already selected value.

How can this be accomplished?

<
7条回答
  •  太阳男子
    2021-01-05 02:25

    Have you tried .blur()?

    $('#MyID').blur(function(){
        //my function
    });
    

    Please note that you will have to click somewhere outside the dropdown menu on the page before the function will trigger. I don't know if this can be passed.

    JsFiddle here

提交回复
热议问题