Copy codeThe Code is as follows:
$. Fn. hDialog = function (options ){
Var defaults = {
Width: 300,
Height: 200,
Title: 'Here title ',
Html :'',
IconCls :'',
Submit: function () {alert ('executable code .');}
}
Var id = $ (this). attr ('id ');
Options = $. extend (defaults, options );
Var self = this;
$ (Self). dialog ({
Title: options. title,
Height: options. height,
Width: options. width,
IconCls: options. iconCls,
Buttons :[{
Text: 'OK ',
IconCls: 'icon-OK ',
Handler: options. submit
},{
Text: 'cancel ',
IconCls: 'icon-cancel ',
Handler: function (){
$ ('#' + Id). dialog ('close ');
}
}]
});
Function createContent (){
$ ('. Dialog-content ', $ (self )). empty (). append ('<div id = "' + id + '_ content" style = "padding: 5px;"> </div> ');
$ ('#' + Id + "_ content" ).html(options.html );
}
CreateContent ();
}
Call:
Copy codeThe Code is as follows:
$ (Function (){
Var d = $ ('<div id = "d"> </div> ');
$ ('# D'). hDialog ({submit: function () {$ (d). dialog ('close ');}});
})