簡體   English   中英

jQuery語法提交表單

[英]jquery syntax submit form

<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沒有鏈接,但它在同一文件夾中……而且我不確定如果這是我的語法

您要在表單存在之前對其進行綁定,請使用$(document).ready

$(document).ready(function() {
    $("#form").submit(function() {
        alert("click");
    });
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM