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>

I've been starting at this code for a while now and I can't see what I'm doing wrong, I thought maybe my jQuery wasn't linking but it is in the same folder... and I wasn't sure if it's my syntax or not.

1
  • From the jQuery tutorial: "As almost everything we do when using jQuery reads or manipulates the document object model (DOM), we need to make sure that we start adding events etc. as soon as the DOM is ready. To do this, we register a ready event for the document.". Commented Nov 22, 2012 at 22:21

1 Answer 1

5

You are binding it before the form exists, use $(document).ready:

$(document).ready(function() {
    $("#form").submit(function() {
        alert("click");
    });
});
Sign up to request clarification or add additional context in comments.

1 Comment

...damit, I knew it was some small detail. Thankyou

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.