Plugin:
Purpose: click the link or button to confirm whether to continue the current operation.
Plug-insCode:
Copy code The Code is as follows: (function ($ ){
$. FN. confirmer = function (options ){
VaR defaults = {
MSG: "Are you sure to delete it? "
}
VaR Options = $. Extend (defaults, options );
Var control = $ (this );
$ (Control). Click (function () {return confirm (options. msg );});
};
}) (Jquery );
Usage:
1. $ (". Delete"). confirmer ();
2. $ (". Delete"). confirmer ({MSG: 'Are you sure you want to delete it? '});
Example: Copy code The Code is as follows: <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> jquery. confirmer. js </title>
<Meta http-equiv = "Content-Type" content = "text/html; char set = UTF-8"/>
<SCRIPT type = "text/JavaScript" Language = "JavaScript" src = "JS/jquery. js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" Language = "JavaScript" src = "JS/jquery. confirmer. js"> </SCRIPT>
<SCRIPT type = "text/JavaScript">
$ (). Ready (function (){
$ (". Delete"). confirmer ();
// $ (". Delete"). confirmer ({MSG: 'Are you sure you want to delete it? '});
})
</SCRIPT>
</Head>
<Body>
<Button id = "btndelete" class = "delete"> Delete </button>
<A id = "lnkdelete" class = "delete" href = "http://www.baidu.com"> Delete </a>
</Body>
</Html>