I开发者_如何学JAVA have an issue with jquery ui modal box. I initially opened the modal box and entered some values in the fields and closed the modal box without saving data. Then again when i opened the modal box, previously entered data is still preset on the screen and takes few seconds to refresh.
Did anyone come across this issue?
Thank you.
You need to clear the fields as part of the dialog's close
event:
$( ".selector" ).dialog({
...
close: function(event, ui) {
$(':input', form).each(function() {
type = this.type;
if (type == 'text' || type == 'password' || type == 'textarea') {
this.value = "";
} else if (type == 'checkbox' || type == 'radio') {
this.checked = false;
} else if (this.tagName.toLowerCase() == 'select') {
this.selectedIndex = -1;
}
});
}
});
精彩评论