How to fire a change event on a HTMLSelectElement if the new value is the same as the old?

后端 未结 8 1514
天命终不由人
天命终不由人 2020-11-28 23:29

I have the following markup:


                        
    
提交评论

  • 2020-11-29 00:25

    It's not firing because the value hasn't "changed". It's the same value. Unfortunately, you can't achieve the desired behaviour using the change event.

    You can handle the blur event and do whatever processing you need when the user leaves the select box. That way you can run the code you need even if the user selects the same value.

    0 讨论(0)
  • 提交回复
    热议问题