I want to create a dialog with function for button in this dialog by call a function. But it does not work.
My code below
//Function initial dialog
function inti_dlg(selector, autoOpen, height, width, modal, num_button, fn_apply, fn_cancel, fn_close)
{
if (num_button>1)
{
selector.dialog({
autoOpen: autoOpen,
height:height,
width:width,
modal:modal,
buttons:{
Apply:function(){fn_apply},
Cancel:function(){fn_cancel}
},
close:function(){fn_close}
});
}
else{
selector.dialog({
autoOpen: autoOpen,
height:height,
width:width,
modal:modal,
buttons:{
Apply:function(){fn_apply}
},
close:function(){fn_close}
});
}
}
//Function abc
function abc()
{
alert("abc");
}
// Call initial dialog function
$(function (){
inti_dlg($('#cde'), false, 440, 480, true, 1, abc(), '', abc());
$('#clickhere').click(function(){$('#cde').dialog('open');});
});
Html :
<div id="clickhere">Click here</div>
<div id="cde">
<div>Test : pass argument as a function</div>
</div>