【问题标题】:jquery ui modaljquery ui 模态
【发布时间】:2011-10-04 01:35:54
【问题描述】:

我对 jquery ui 模态框有疑问。我最初打开模态框并在字段中输入一些值并关闭模态框而不保存数据。然后当我再次打开模态框时,之前输入的数据仍然预设在屏幕上,需要几秒钟才能刷新。

有人遇到过这个问题吗?

谢谢。

【问题讨论】:

    标签: jquery user-interface modal-dialog


    【解决方案1】:

    您需要在对话框的close 事件中清除这些字段:

    $( ".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;
               }
           });
       }
    });
    

    【讨论】:

      猜你喜欢
      • 2011-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-16
      • 2015-01-26
      • 1970-01-01
      相关资源
      最近更新 更多