由于未知原因,Javascript无法工作
我正在使用自定义选项表单。这是密码由于未知原因,Javascript无法工作,javascript,php,jquery,html,forms,Javascript,Php,Jquery,Html,Forms,我正在使用自定义选项表单。这是密码 <div class="form fix"> <p class="form-text">Fill This Out and See Your<br>Timeshare Report</p> <form name="contactform" action="mail-script.php" method="POST"> <label for="fname">F
<div class="form fix">
<p class="form-text">Fill This Out and See Your<br>Timeshare Report</p>
<form name="contactform" action="mail-script.php" method="POST">
<label for="fname">First Name:
<input type="text" name="fname" id="fname" />
</label>
<br>
<label for="lname">Last Name:
<input type="text" name="lname" id="lname" />
</label>
<br>
<label for="email">Email Address:
<input type="text" name="email" id="email" />
</label>
<br>
<label for="phone">Phone Number:
<input type="text" name="phone" id="phone" />
</label>
<br>
<label for="phone">Alternate Phone:
<input type="text" name="phone" id="aphone" />
</label>
<br>
<label for="resort">Resort Name:
<input type="text" name="resort" id="resort" />
</label>
<br>
<label for="amount">Amount Owed? $:
<input type="number" name="amount" id="amount" />
<p style="font-size: 12px !important;margin-top: -14px;padding-right: 30px;text-align:right;">If Paid Off Leave Zero, Else Put Amount</p>
</label>
<br>
<div class="checkbox">
<div class="check-text fix">
<p>I'm Considering To</p>
</div>
<div class="check-one fix">
<input type="checkbox" name="call" id="" value="sell" />Sell It
<br>
<input type="checkbox" name="call" id="" value="buy" />Buy It
<br>
<input type="checkbox" name="call" id="" value="rent " />Rent It
</div>
<div class="check-two fix">
<input type="checkbox" name="call" id="" value="cancel" />Cancel Mortgage
<br>
<input type="checkbox" name="call" id="" value="ownership" />End Ownership
<br>
<input type="checkbox" name="call" id="" value="give" />Give It Back
</div>
</div>
<p class="captcha">
<img src="captcha_code_file.php?rand=<?php echo rand(); ?>" id='captchaimg'>
<br>
<label for='message'>Enter the code above here :</label>
<br>
<input id="6_letters_code" name="6_letters_code" type="text">
<br> <small>Can't read the image? click <a href='javascript: refreshCaptcha();'>here</a> to refresh</small>
</p>
<input id="submit" type="submit" value="" />
<p class="submit-text">Ensure all fields are completed and correct, allowing you more benefits, while preventing abuse of our data.</p>
</form>
</div>
</div>
但由于未知原因,此代码不起作用,以下是页面url
我的目标是在用户提交表单时向用户显示一条成功消息,我认为javascript是一种简单的方法,但是如果你能想出更好的替代方法,我将非常感激
目前表单的工作方式如下:
你用过的东西是和不是。为了使这一点起作用,您需要在head部分中包含
jQuery.js
。在
标记中添加以下内容:
如果要使用JavaScript,可以进行以下更改:
原件:
修改:
请添加比“它不工作”更详细的信息。您尝试过如何修复或调试它?你检查控制台了吗?jQuery.js是否包含在页面中?装得好吗?您的代码在DOMReady之前运行吗?是否显示了警报()
,但表单仍在提交中?在这里与我们合作…我在表单下方的index.html中添加了代码。请检查更新的问题。如果我没有错,jquery.js是missing@Danyal未捕获引用错误:$未定义
$('form').on('submit',function(){
alert('submitted');
});