有没有人想到用bind方法绑定click事件?修改了一点代码运行没效果!!求大神看过来!!
<!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> <link href="style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="http://www.imooc.com/data/jquery-1.8.2.min.js"></script> <script type="text/javascript" src="http://www.imooc.com/data/jquery.form.js"></script> </head> <body> <form id="frmV" method="post" action="#"> <div id="divtest"> <div class="title"> <span class="fl">个人信息页</span> <span class="fr"> <input id="btnSubmit" type="button" value="提交" /> </span> </div> <div class="content"> <span class="fl">用户名:</span><br /> <input id="user" name="user" type="text" /><br /> <span class="fl">昵称:</span><br /> <input id="nick" name="nick" type="text" /> <div class="tip"></div> </div> </div> </form> <script type="text/javascript"> $(function () { $("#btnSubmit").bind("click",function(){ $("form").ajaxForm( { url: "http://www.imooc.com/data/form_f.php", target: ".tip"}); }); }); //之所以没绑定按钮bind因为type=“submit”,系统默认提交到后台 </script> </body> </html>
我把按钮的改为type="button"为其绑定click事件,但是运行不出来