In this article I am going to show you how to validate and reset Summernote (To know more about summernote click on link).
So, for this firstly we get the value of editor and store in a variable just like (Editor is id of summernote) :
After this we replace symbols like <, >, / with space ' ', because of the default value of summernote
is '<p> <br/> </;p>'
Final code is :
Now, for reset the summernote value :
I hope ,it will help you.
So, for this firstly we get the value of editor and store in a variable just like (Editor is id of summernote) :
1: var code = $('#Editor').summernote('code');
Final code is :
1: var code = $('#Editor').summernote('code');
2: var filteredContent = (code).replace(/\s+/g, '');
3:
4: if (filteredContent.length == 0) {
5: $('.note-editable').css({ 'border': 'solid 1px red' }).focus();
6: // if summernote is empty
7: isValid = false;
8: }
9:
Now, for reset the summernote value :
1: $('#Editor').summernote('code', '');