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 programmatically modifying the AppSetting value in web.config using c#?
- TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined
- How to calculate the age from jQuery ui datepicker using c#?
- How to calculate days difference between two dates in c#?
- Changing date format in jQuery ui datepicker
- How to set value to nicedit textarea using jQuery?
- How to load data from json file in angular?
- cannot find module consider using '--resolvejsonmodule' to import module with json extension angular
Related Article