Bind click event on select option

前端 未结 7 1272
长情又很酷
长情又很酷 2021-01-17 21:54

I\'ve got a problem making a click event on an HTML option element work.

Even a simple console.log(\'hello!\'); won\'t work.

7条回答
  •  攒了一身酷
    2021-01-17 22:03

    because change not good enough for me and I didn't find a way to trigger the option click what I did is

     $('#mySelect').click(function () {
            if ($(this).attr('optionclick') == '1') {
                 $(this).attr('optionclick', '0');
            }
            else {
                 $(this).attr('optionclick', '1');
            }
      });
    

提交回复
热议问题