0
<html>
    <head>
        <script type="text/javascript" src="http://www.superpseudostocks.com/SPS/js/jquery-1.8.2.min.js"></script>
        <script type="text/javascript">
            $("#form").submit(function () {
                alert("click");
            });
        </script>
    </head>
    <body>
        <div style="width:517px; margin-top:20px;height:260px;">
            <form id="form" action="javascript:void(0);" method="POST">
                <fieldset style="height:200px;" id="Withdraw">
                    <legend><b><font size="4" color=black>Deposit</font></b>
                    </legend> <font color="black" size=4>Deposit funds into system balance from registered bank account</font>
                    <br>
                    <br>
                    <div style="width:480px; height:20px; margin: auto;" id="ErrorBox"></div>
                    <br> <span class="tab2"></span>
                    <label for='amount'><font color="black"><b>Please enter an amount to withdraw from bank account</b></font> </label>
                    <br> <span class="tab3"></span>$
                    <input type='text' name='Amount' id='Amount' maxlength="50" size="40" />
                    <br>
                    <br>
                    <input style="width:100px; height:40px;" type='SUBMIT' name='Confirm' value='Confirm' />
                </fieldset>
            </form>
        </div>
    </body>
</html>

我已经开始使用这段代码一段时间了,我看不出我做错了什么,我想也许我的 jQuery 没有链接,但它在同一个文件夹中......我不确定如果这是我的语法或不是。

4

1 回答 1

5

您在表单存在之前绑定它,使用$(document).ready

$(document).ready(function() {
    $("#form").submit(function() {
        alert("click");
    });
});
于 2012-11-22T22:12:14.633 回答