jQuery textbox change event

前端 未结 6 1288
孤城傲影
孤城傲影 2020-12-09 09:29

Does text input element not have a change event? When I attach a change event handler to a text input it is not being fired. Keyup is fired, but keyup is not sufficient for

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-09 09:30

    You can achieve it:

     $(document).ready(function(){              
         $('#textBox').keyup(function () {alert('changed');});
     });
    

    or with change (handle copy paste with right click):

     $(document).ready(function(){              
         $('#textBox2').change(function () {alert('changed');});
     });
    

    Here is Demo

提交回复
热议问题