2012-10-16 56 views
0

我有一个文本框,我试图变成wyiswyg(使用jwysiwyg)。文本框不存在于页面上,直到ajax请求被触发,并通过请求将其加载到页面中。ajax请求后触发一个插件

我的问题是,我不能让文本框变得与正常

$('.wysiwyg').wysiwyg();作为.wysiwyg所见即所得不存在于DOM Ready我怎么能解决这个问题,我曾尝试以下,

$("a.suggest-date").click(function(){ 
     var self = $(this).attr('href'); 
     $("#mask").show(); 
     $("#suggestedDate").children().remove(); 
     $("#send-date textarea").val(""); 
     $.get(self + '#suggestedDate', null, function(result){ 
      $("#ajax-loaded").append(result); 
      $(".wysiwyg").wysiwyg(); 
     }); 
     //$("#ajax-loaded").load(self + "#suggestedDate") 
     $("#ajax-loaded").show(); 
     setTimeout(function() { $("#ajax-loaded").removeClass("loading"); $("#ajax-loaded header.loading").hide(); }, 500); 
     return false; 
    }); 

我在做什么明显错误?

+0

http://api.jquery.com/ajaxSuccess/ – gearsdigital

回答

3
$.get(self + '#suggestedDate').then(
    $(".wysiwyg").wysiwyg(); 
); 

Read more

这将允许你打电话.wysiwyg()一旦你的$不用彷徨调用成功。