How do I implement onchange of <input type=“text”> with jQuery?

后端 未结 14 1162
[愿得一人]
[愿得一人] 2020-11-27 10:15

?

14条回答
  •  我在风中等你
    2020-11-27 10:53

    You can use .change()

    $('input[name=myInput]').change(function() { ... });
    

    However, this event will only fire when the selector has lost focus, so you will need to click somewhere else to have this work.

    If that's not quite right for you, you could use some of the other jQuery events like keyup, keydown or keypress - depending on the exact effect you want.

提交回复
热议问题