The JavaScript confirmation dialog box is used to handle user’s agreement on any option.Here, I will show you how to use a JavaScript alert confirm, it prompts a dialog box with two buttons OK and Cancel.
If the User click the ok button, the JavaScript window method will return true. If we have written any server side coding for the button, that will perform in the operation. If the user clicks the Cancel button, the confirm button will return false.
HTML & JavaScript CODE:
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript">
$(function () {
$("#btnSubmit").click(function () {
var result = confirm("Areyou sure wants to continue ?");
if (result == true) {
return true;
}
else {
return false;
}
});
});
</script><input id="btnSubmit" type="submit" value="submit" />
Post your comments / questions
Recent Article
- How to add two numbers in Android Studio? | Source Code
- FindViewByID returns null in android studio -SOLVED
- Saving changes is not permitted in SQL SERVER - [SOLVED]
- Restore of database failed. File cannot be restored over the existing. -[SOLVED]
- One or more projects in the solution were not loaded correctly in Visual Studio 2019 | FIXED
- How to find Laptop's Battery Health?
- SOLVED-Related Field got invalid lookup: icontains error in Django
- How to enable Search Feature in Django admin?
Related Article