最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - JHtmlArea Set html - Stack Overflow

programmeradmin0浏览0评论

I have been using the jhtmlarea for a wysiwyg editor. Most of it is working. Though I can't figure out how to set the html inside of the textarea.
I have tried .html, .val, .attr('value',''), .text, though none of them work.

Any suggestions on how to do this/a better solution?

Thanks

I have been using the jhtmlarea for a wysiwyg editor. Most of it is working. Though I can't figure out how to set the html inside of the textarea.
I have tried .html, .val, .attr('value',''), .text, though none of them work.

Any suggestions on how to do this/a better solution?

Thanks

Share Improve this question asked Apr 4, 2011 at 4:12 JessJess 8,6906 gold badges51 silver badges68 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 8

Set the original text area value and call updateHtmlArea:

$('#textAreaID').val(newHtml).htmlarea('updateHtmlArea');

This works for me

$("#yourTextArea").htmlarea('pasteHTML', "HTML to paste");

Hope it helps you and someone else :)

Not sure if this is what you're after but if you mean setting the text inside the jHtmlArea iFrame then you'll need to use the pasteHTML("text to insert"); method.

E.g.

$("#myTextAreaId").htmlarea ({ this.pasteHTML("Here's some programtically entered text."); })

发布评论

评论列表(0)

  1. 暂无评论