开发者

jquery ui modal

开发者 https://www.devze.com 2023-03-19 15:37 出处:网络
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

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;
           }
       });
   }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消