Trigger the event when selected the same value in dropdown?

后端 未结 5 612
予麋鹿
予麋鹿 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:32

    This basic idea should work using jQuery using click event:

    $('#yourselect').click(function() {
      console.log("your function");
    });
    

    A simple if statement could prevent firing off the function when initially clicking the select element.

提交回复
热议问题