I am trying to use UI dialog to create a modal dialog.
The dialog workscorrectly, and all is well. I close the dialog using the \"X\" in the corner.
I tried using
If you want to reopen it again just use this code again:
$('#New_WorkBoard_Dialog').dialog('open');
Don't bother destroying and reinitializing the dialog. There's no need for that.
As Ra Yell said, is better to clean it before closing it, this way you don't have to worry about it when you open the dialog again.
$('input').val('');
The previous instruction worked for me.
You can clear all input elements dynamically.
$("#New_WorkBoard_Dialog input[type='text']").each(function(index, element) {
$(element).val("");
)};
If you prefer, you can clear it on close event of the dialog:
$('#New_WorkBoard_Dialog').dialog({
autoOpen: false,
height: 530,
width:300,
modal: true,
resizable:false,
buttons: {
Cancel: function() {
$(this).dialog('close');
//$('#New_WorkBoard_Dialog').dialog('destroy');
},
'Register board': function() {
var board_name=document.getElementById("name");
var comments=document.getElementById("comment");
Createboard(board_name,comments);
$(this).dialog('close');
}
},
close: function() {
$("#New_WorkBoard_Dialog input[type='text']").each(function(index, element) {
$(element).val("");
)};
}
});