发布时间:2018-11-29编辑:佚名阅读(1869)
页面代码:
1 2 3 4 5 6 7 8 9 10 | < script type = "text/javascript" src = "http://code.jquery.com/jquery-1.9.1.min.js" ></ script > </ head > < body > < div > < form action = "a.html" method = "post" > < input type = "text" id = "text" /> < input type = "button" value = "提交查询" id = "btn" /> </ form > </ div > </ body > |
加个onclick事件判断下
1 2 3 4 5 6 7 8 9 | $( function (){ $( "#btn" ).click( function (){ var t=$( "#text" ).val().length; if (t<=10){ alert( "长度不够!!" ); return false ; } }); }); |
下一篇:ajax与302响应
0人
0人
0人
0人