我一直在尝试这几个小时,不知道为什么.submit()只是没有响应。
尝试使用不同版本的jquery,但同样......
任何人都知道下面有什么问题?
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#btn1").click(function(e){
e.preventDefault();
alert('after prevent');
$("#myForm").submit();
});
$("#myForm").on("submit", function(){
alert('on submit');
});
$(document).bind("contextmenu",function(e){
return false;
});
});
</script>
</head>
<body>
<form id="myForm" name="myForm" action="https://google.com" method="post">
<input class=' form-control' id="inputFirst" size='4' type='text' placeholder="First Name" data-error="First Name is required" name="fields_fname" Required>
<input class=' form-control' id="inputLast" size='4' type='text' placeholder="Last Name" data-error="Last Name is required" name="fields_lname" Required>
<input type="tel" class='form-control' id="inputPhone" size='4' placeholder="Phone" maxlength="10" name="fields_phone" data-fphonelen="00"
data-fphonefirst="00" Required>
<input type="email" class="form-control" id="inputEmail" placeholder="Email" data-error="Email is required" name="fields_email" required>
<input name="submit" type="button" class="submit" value="Tap to Qualify" id="btn1">
</form>
</body>