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

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

?

14条回答
  •  误落风尘
    2020-11-27 10:54

    If you want to trigger the event as you type, use the following:

    $('input[name=myInput]').on('keyup', function() { ... });
    

    If you want to trigger the event on leaving the input field, use the following:

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

提交回复
热议问题