Search code examples

Get Correct HTML from Summernote form when the content has not been edited

I am using this code to display summernote editor on my page

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<script src=""></script>
<link href="" rel="stylesheet">
<script src=""></script>
<textarea id="summernote" name="summernote">@Model.InviteEmailBody</textarea>
                        tabsize: 4,
                        height: 220
                    $('#summernote').on('summernote.blur', function () {


Then saving to database

string str = Request.Form["summernote"];
string htmlEncoded = WebUtility.HtmlEncode(str);
roleToUpdate.InviteEmailBody = htmlEncoded;

Everything is fine when I actually edit the content, but when i don't, the value I fet in str variable has a lot of


I am not sure if the way I implemented summernote is correct or how would I fix this problem.. if anybody can help I would appreciate it


  • This garbage is produced by


    If you want to have your textarea cleaned up (or predifed with some text), you may use the following syntax. The second argument is a string value you want to set:

    $('#summernote').summernote('code', '')
    $('#summernote').html(escape($('#summernote').summernote('code', '<b>some</b>')));