溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Jquery獲取ckEditor的內(nèi)容

發(fā)布時(shí)間:2020-06-10 08:24:27 來(lái)源:網(wǎng)絡(luò) 閱讀:1024 作者:leedet 欄目:web開(kāi)發(fā)

在頁(yè)面中我載入了ckEditor作為我程序內(nèi)容的輸入。

 

  1. <textarea name="content" id="content"></textarea><br> 
  2. <input type="submit" value="submit" onclick="submit()"> 
  3.  <script src="/ckeditor/ckeditor.js"></script> 
  4.     <script type="text/javascript"> 
  5.         CKEDITOR.replace('content',{ 
  6.             filebrowserBrowseUrl:           '/ckfinder/ckfinder.html?Type=Files', 
  7.             filebrowserImageBrowseUrl:      '/ckfinder/ckfinder.html?Type=Images', 
  8.             filebrowserFlashBrowseUrl:      '/ckfinder/ckfinder.html?Type=Flash
  9.         }); 
  10.       
  11.     </script> 

但是我頁(yè)面中是使用Jquery進(jìn)行頁(yè)面提交的,但是直接用$("#content").val()是無(wú)法拿到content內(nèi)容的。這里我們需要使用ckEditor內(nèi)置的函數(shù)來(lái)拿到這個(gè)內(nèi)容。

 

  1. var oEditor = CKEDITOR.instances.content; 
  2. var content = oEditor.getData(); 

 

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI