Shweta M
Shweta M

Reputation: 146

Summernote content coming with html tags

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.

Upvotes: 7

Views: 20578

Answers (5)

mehul
mehul

Reputation: 41

in laravel, simple use

{!! $product->small_description !!} 

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

in blade file where you want to fetch the data

Upvotes: 4

Mtvw
Mtvw

Reputation: 336

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.

Upvotes: 1

easylogic
easylogic

Reputation: 156

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

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

Upvotes: 2

Shweta M
Shweta M

Reputation: 146

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

Upvotes: 1

user4710450
user4710450

Reputation:

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

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

Upvotes: 3

Related Questions