I would like to know how to reset or clear the bootstrap Summernote WYSIWYG editor using jQuery or JavaScript.
I tried below codes
$('#MyForm').delay(1000).resetForm(1000);
This dose reset the whole form except for the textarea with the Summernote
$('#SummernoteText').reset();
SummernoteText is the html textarea but the code doesn't do anything at all.
$('#SummernoteText').destroy();
Above seems to distroy the editor instead of clearing the editor.
Can someone point me out the way to do this.
Link to Summernote http://summernote.org/#/
You can customize it with popover. air option. $('#summernote'). summernote({ popover: { air: [ ['color', ['color']], ['font', ['bold', 'underline', 'clear']] ] } });
You can disable editor by API. $('#summernote'). summernote('disable'); If you want to enable editor again, call API with enable.
summernote-themes Most of the themes are easily added by swapping out the CSS File in place of the original supplied by the Summernote team. In this repository we supply a minified, unminified, version using Summernote's Icons, a version using LibreICON Icons (black and colour embedded).
The Summernote Editor is a free & open-source super simple WYSIWYG editor based on Bootstrap & jQuery.
A little late, but just to add:
Option 1:
$('#SummernoteText').summernote('reset');
This solution will only work if your editor was initially empty
This will reset your editor to its original state. Meaning, if you initialized it with any data, the same data will re-appear on reset.
Option 2:
$('#SummernoteText').summernote('code', '<p><br></p>');
The reason for adding the <p><br></p>
tags instead of just plain ''
is that summernote editing area needs it for focus. (Reference)
For Summernote 0.8.1 version use this simple code:
$("#SummernoteText").summernote("reset");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With