1

我有一个 ckeditor,下面是我用于 ckeditor 的 textarea 和它的内容,我怎样才能只在<p id="footer"></p>使用 jquery的内部获取内容

<textarea id="cheditor_text" name="cheditor_text" rows="10">
<p> welcome to our company </p>
<p id="footer">
Copy right @ exak=mple.com
</p>
</textarea>
4

4 回答 4

1
于 2012-12-29T21:44:38.650 回答
1

阅读此链接,它很有帮助。

尝试使用getData();

有用的链接

于 2012-12-28T09:32:33.273 回答
0

你可以这样做,

现场演示

txt = $('#cheditor_text').text();
html = $('<div>').append(txt).find('#footer').prev()[0].outerHTML;

不使用 outHTML

现场演示

txt = $('#cheditor_text').text();
pTag = $('<div>').append(txt).find('#footer').prev();
alert($('<div>').append(pTag).html())​
于 2012-12-28T09:26:58.053 回答
0

尝试

var value = CKEDITOR.instances['cheditor_text'].getData();
$(value).find('#footer').html();

或者

$('#cheditor_text').ckeditor(function( textarea ){
$($(textarea).val()).find('#footer').html();
});
于 2012-12-28T09:30:08.203 回答