标签:
1、结论:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <form action=""> <input type="text" class="text1"/> <span>0</span> </form> <form action=""> <input type="text" class="text2"/> <span>0</span> </form> </body> <script src="libs/jquery-1.8.3.min.js"></script> <script type="text/javascript"> $(function(){ var i = 0; $(".text1").keydown(function(){ $(this).next().text(i+=1); }); var j = 0; $(".text2").keypress(function(){ $(this).next().text(j+=1); }); //输入中文时有区别 }) </script> </html>
jQuery基础:keydown( ) 与 keypress( ) 区别
标签:
原文地址:http://www.cnblogs.com/gao-xiong/p/5935305.html