Comfirm pop-up window based on bootstrap modal frame

Source: Internet
Author: User

The finished results are as follows:

The HTML code is as follows:

        <ButtonID= "BTN">Click the popup pop-up box</Button>        <!--pop-up box -        <Divclass= "Modal Fade"ID= "Confirm_like"TabIndex= "-1">            <!--Window Declaration -            <Divclass= "Modal-dialog modal-sm">                <!--Content Statement -                <Divclass= "Modal-content">                    <Divclass= "Modal-header"style= "padding-top:10px; padding-bottom:10px;">                        <Buttonclass= "Close"Data-dismiss= "Modal">                            <span>&times;</span>                        </Button>                        <h4class= "Modal-title"ID= "Mymodallabel"></h4>                    </Div>                    <Divclass= "Modal-body">                        <DivID= "Modal_con"style= "Text-align:center;"></Div>                        <DivID= "Firstdiv"></Div>                    </Div>                    <Divclass= "Modal-footer"style= "text-align:center; padding-top:10px; padding-bottom:10px;margin-top:0;">                        <Buttonclass= "btn btn-sm btn-success"Data-dismiss= "Modal"ID= "Ok_btn">Determine</Button>                        <Buttonclass= "btn btn-sm btn-success"Data-dismiss= "Modal"ID= "Cancel_btn">Cancel</Button>                    </Div>                </Div>            </Div>        </Div>

The JS code is as follows:

$ ("#btn"). Click (function(){        //calledShow_confirm (' Hint ', ' data submission ', Certain,cancel);    }); //Show Popup Functions    functionshow_confirm (title, MSG, Ok_callback,cancel_callback) {$ ("#isConfirm"). Val (' false '); $("#myModalLabel"). Text (title);//this sets the header of the pop-up window$ ("#modal_con"). Text (msg);//set the information for the prompt$ ("#confirm_like"). Modal ({//Show pop -up windowShow:true,            //backdrop:true, remove mask layer        }); //Determining button Event functions$ ("#ok_btn"). Click (function(){            if($.isfunction (Ok_callback)) {$ (' #confirm_like '). Off (' Hidden.bs.modal ');//Unbinding events To prevent multiple bindings$ (' #confirm_like '). On (' Hidden.bs.modal ',function() {Ok_callback ("This is OK");});        }        }); //Cancel button Event function$ ("#cancel_btn"). Click (function(){            if($.isfunction (Cancel_callback)) {$ (' #confirm_like '). Off (' Hidden.bs.modal '); $(' #confirm_like '). On (' Hidden.bs.modal ',function() {cancel_callback ();});        }        }); //Close button event function for pop-up window$ ("#confirm_like. Close"). Click (function(){            if($.isfunction (Cancel_callback)) {$ (' #confirm_like '). Off (' Hidden.bs.modal '); $(' #confirm_like '). On (' Hidden.bs.modal ',function() {cancel_callback ();});    }                    }); }    functioncertain (str) {alert (str); }    functionCancel () {alert ("This is canceled"); }

Comfirm pop-up window based on bootstrap modal frame

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.