Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuerySubmit不会启动_Jquery_Submit - Fatal编程技术网

jQuerySubmit不会启动

jQuerySubmit不会启动,jquery,submit,Jquery,Submit,我有一些代码如下: <!doctype html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>StarTrackr!</title> <script src="../../lib/jquery-1.7.1.

我有一些代码如下:

<!doctype html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>StarTrackr!</title>
        <script src="../../lib/jquery-1.7.1.min.js" type="text/javascript"
        charset="utf-8"></script>
        <script type="text/javascript">
        $(document).ready(function () {

            $('div').load('1.htm');
            // The above function does work

            $("#testform").submit(function () {
                //Code after form submitted and this does not fire
                alert("hi");
            });    
        });         
        </script>
    </head>
    <body>
        <div></div>
        <form id="testform">Email:
            <input type="text" name="email" />
            <br />First Name:
            <input type="text" name="fname" />
            <br />Last Name:
            <input type="text" name="lname" />
            <br />
            <input type="button" name="submit" id="submit" value="Submit" />
        </form>
    </body>    
</html>

星际追踪器!
$(文档).ready(函数(){
$('div').load('1.htm');
//上述功能确实有效
$(“#testform”).submit(函数(){
//表单提交后的代码,此代码不会触发
警报(“hi”);
});    
});         
电邮:

名字:
姓氏:
当我点击submit按钮时,警报(hi)应该会弹出,但不会。有人知道为什么吗?假设Jquery库已正确加载

谢谢,
Jim

输入
需要有
type=“submit”
,而不是
type=“button”

输入
需要有
type=“submit”
,而不是
type=“button”
将type=“button”更改为type=“submit”



将type=“button”更改为type=“submit”

input type=“button”
更改为
input type=“submit”
input type=“button”
更改为
input type=“submit”
仓库-谢谢!type=按钮是直接从一本关于Jquery的书中选出来的,我错过了一个打字错误。Depot-谢谢!type=按钮是直接从一本关于Jquery的书中取出来的,我没有注意到这个打字错误。
<input type="button" name="submit" id="submit" value="Submit" />