2010-01-23 31 views
0

我對此很新,所以非常感謝您的幫助。我使用簡單模態生成模態流行音樂,此工作正常。在ASP.NET中使用自動完成功能的簡單模式

我現在想要將jquery自動完成添加到元素txtEmail。當我在簡單模態之外運行頁面時,我可以使用自動完成,但是當通過簡單模式加載頁面時,它不起作用。

我已檢查以確保該元素已加載,並且允許我更改文本顏色,但無法將自動填充添加到該元素。

的代碼是

/** 
* @author Daniel 
*/ 
jQuery(function($) { 

    $("input.ema, a.ema").click(function(e) { 
     e.preventDefault(); 
     $("#osx-modal-content").modal({ 
      appendTo: 'form', 
      overlayId: 'osx-overlay', 
      containerId: 'osx-container', 
      closeHTML: '<div class="close"><a href="#" class="simplemodal-close">X</a></div>', 
      minHeight: 80, 
      opacity: 65, 
      position: ['0', ], 
      overlayClose: true, 
      onOpen: OSX.open, 
      onClose: OSX.close, 
      onShow: OSX.show 

     }); 
    }); 

    var OSX = { 
     container: null, 
     open: function(d) { 
      var self = this; 
      $.ajax({ 
       url: "/Message/UserMessage/", 
       type: 'GET', 
       dataType: 'html', // <-- to expect an html response 
       success: function(result) { 
        var data = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" "); 
        $('div#osx-modal-data').html(result).find("#txtEmail").css('color', '#c00'); 

        if ($('div#osx-modal-data').find("#txtEmail").length) { // implies *not* zero 
         $('div#osx-modal-data').find("#txtEmail").autocomplete(data); 
         alert('We found img elements on the page using "img"'); 
        } else { 
         alert('No txtEmail elements found'); 
        } 
       } 
      }); 


      self.container = d.container[0]; 
      d.overlay.fadeIn('slow', function() { 
       $("#osx-modal-content", self.container).show(); 
       $('div#osx-modal-title').html("Send Email"); 
       var title = $("#osx-modal-title", self.container); 
       title.show(); 

       d.container.slideDown('slow', function() { 
        setTimeout(function() { 
         var h = $("#osx-modal-data", self.container).height() + 
         title.height() + 
         20; // padding 
         d.container.animate({ 
          height: h 
         }, 200, function() { 
          $("div.close", self.container).show(); 
          $("#osx-modal-data", self.container).show(); 

         }); 
        }, 300); 
       }); 
      }) 

     }, 
     close: function(d) { 
      var self = this; 
      d.container.animate({ 
       top: "-" + (d.container.height() + 20) 
      }, 500, function() { 
       self.close(); // or $.modal.close(); 
      }); 
     }, 
     show: function(d) { 

      // $('div#osx-modal-data').find("#txtEmail").css('color', '#ccc') 
     } 
    }; 
}); 

回答

0

我找到了答案,文本框的Z指數比SimpleModal低,所以當我增加了它的工作文本框的Z指數。