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 create custom 404 error page in Django?
- Requested setting INSTALLED_APPS, but settings are not configured. You must either define..
- ValueError:All arrays must be of the same length - Python
- Check hostname requires server hostname - SOLVED
- How to restrict access to the page Access only for logged user in Django
- Migration admin.0001_initial is applied before its dependency admin.0001_initial on database default
- Add or change a related_name argument to the definition for 'auth.User.groups' or 'DriverUser.groups'. -Django ERROR
- Addition of two numbers in django python
Related Article