<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没有链接但是它在同一个文件夹中......我不知道不确定这是不是我的语法。
答案 0 :(得分:5)
您在表单存在之前绑定它,使用$(document).ready
:
$(document).ready(function() {
$("#form").submit(function() {
alert("click");
});
});