2012-10-29 24 views
0

我試圖創建包含Joomla CodeMirror插件的組件。 我用我的文本填充了textarea,現在我想從JQuery中獲取發送到另一個地方的文本。Joomla編輯器通過JQuery發佈內容

jQuery("#button").click(function(event){ 
     jQuery('#spinner').show(); 
     var code = jQuery('#texteditorarea').html(); 

     jQuery.post("index.php?option=com_one&view=One&format=raw", 
     { 
      source:code 
     }, 
     function(data) { 
      jQuery('#spinner').hide(); 
      jQuery("#result").hide().html(data).fadeIn('slow'); 
     }); 
    }); 

在這裏我有一個問題,當我在Joomla編輯器字段(在我的網頁上)更改文本。當我在更改後點擊我的按鈕時,在此代碼中我看不到任何更改。 With

var code = jQuery('#texteditorarea').html(); 

我總是得到初始文本。

如何捕獲Joomla編輯器文本字段中的當前文本?

回答

0

我已經找到答案

相反:

var code = jQuery('#texteditorarea').html(); 

用途:

var code = Joomla.editors.instances['texteditorarea'].getCode();