Dialogs
Dialogs
Hi all,
I have a element that, when clicked, shows a dialog.
To test if the dialog was already opened i'm using a flag.
If the dialog was already opened I do a unbind in the element and add
a new event to it.
Is this procedure correct? I think it isn't much preaty code. Any
suggestions?
THE CODE:
state = 0;
$('#addNewBroadcast').click( function (){
if(state == 1){
$('#addNewBroadcast').unbind('click');
$('#addNewBroadcast').click( function (){
$('#newBroadcastDialog').dialog("open");
});
}else{
$('#newBroadcastDialog').dialog({
draggable:false,
modal:true,
width:300,
height:200
}).show();
state = 1;
}
});