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

前端 未结 7 1762
感动是毒
感动是毒 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:05

    $('#MyID option').hover(function(){
       //user is on an option, but not selected it yet
    },function(){
       //user left an option without selecting
    }).click(function(){
       //user clicked on an option, selecting it
    
    });
    

提交回复
热议问题