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

javascript - Summernote content coming with html tags - Stack Overflow

programmeradmin1浏览0评论

I am new to summernote text editor. I am trying to get the proper content from the summernote textarea, which infact coming with html tags. I tried

    <textarea class="summernote" id="summernote"  ng-model="blog.content" ></textarea>

in my html page and getting the textarea content with,

     $("#summernote").code();

it is fetching the content in html tags. I want the content to be displayed without the html tags.

Thank you for the advice.

I am new to summernote text editor. I am trying to get the proper content from the summernote textarea, which infact coming with html tags. I tried

    <textarea class="summernote" id="summernote"  ng-model="blog.content" ></textarea>

in my html page and getting the textarea content with,

     $("#summernote").code();

it is fetching the content in html tags. I want the content to be displayed without the html tags.

Thank you for the advice.

Share Improve this question asked Mar 27, 2015 at 14:32 Shweta MShweta M 1461 gold badge2 silver badges11 bronze badges
Add a comment  | 

5 Answers 5

Reset to default 4

in laravel, simple use

{!! $product->small_description !!} 

instread of {{! $product->small_description !}}

in blade file where you want to fetch the data

Use val() to get all what entered in textarea or text, So :

var content = $("#summernote").val()

Use $().text() method to get plain text.

$("<div />").html($("#summernote").code()).text();

After a long time of searching , thought instead of trying that in getting summernote text editor value with plain text, why not try with the angular filter. So searched and got the filter which exactly does what I needed.

Here is the link which did my job.

angularjs to output plain text instead of html

I had the same problem, "fixed" it by using version 0.6.16 instead of the current stable version 0.7. HTML is rendering fine now without extra js code.

发布评论

评论列表(0)

  1. 暂无评论