jQuery监听文本框值改变触发事件(propertychange)
转自:https://www.cnblogs.com/linJie1930906722/p/5209135.html
完整代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="jquery-1.9.1.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $(function () { $('#inputId').on/*bind*/("input propertychange", function () { alert("文本框的值:"+$(this).val()); //这里写你的处理代码 }); }); }); </script> </head> <body> <input id="inputId"/> </body> </html>