On confirm the function is called but it skips the HTML5 validation and just redirects. As of now the page is static, no other validation is there.
<label> Email :</label>
<input type="email" class="form-control" id="new_email"
placeholder="Enter Email" required autofocus
autocomplete="off" style="width:300px;"/>
<script type="text/javascript">
function submitdetails() {
if(confirm("Do you want to proceed") == true) {
document.write("Creating your Account, please wait...");
setTimeout('window.location = "confirm.html";',5000);
} else {
document.write("Redirecting to home page, please wait...");
setTimeout('window.location = "new_fss.html";',5000);
}
}
</script>
HTML :
<button type="submit" class="btn btn-primary" style="width:100px;margin-left:50px;" onclick="submitdetails();">Submit</button>
Any suggestions?
The reason the HTML5 isn't kicking in is because your javascript is being run before the validation can trigger.
Your onclick
action is firing, which runs the javascript, which redirects the user.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.