Confirm Box for user choice in jQuery

Confirmation box can be show to the user to confirm the action. Before deleting or updating any records we may want user to remind again for the action.
We will display one dialog box with two options, Yes and No. Based on the user selection by pressing the buttons we can run different part of the script to complete the process.
Let us start with a simple confirmation box where user action is displayed as message.

Initialize the dialog box

We can manage different properties of the dialog box here.
        resizable: false,
        autoOpen: false,
        modal: true,
        title: "Confirm Box",
        height: 250,
        width: 400,
        buttons: {
            "Yes": function () {
                "No": function () {

Callback function

This is where we will execute our script based on the user choice. Any record deletion or updating action can be posted to backend script by using Load, GET or Post here.
function callback(value) {
 if (value) {
  $('#display').html('You clicked Yes button') 
 }// end of if (value )
// code to execute if false
$('#display').html('You clicked No button') 
} // end of callback function 

Opening the dialog box

Inside click function of the button we have kept our code to open the dialog box.
$("#dialog-window").html("Confirm to Submit ...");
$( "#dialog-window" ).dialog( "open" );
Full code you can get in above demo page.


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here .

    Most Popular JQuery Scripts


    Two dependant list boxes


    Calendar with Date Selection


    Data change by Slider


    Show & Hide element

    JQuery Video Tutorials

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer