How to clear text in Summernote on submit?


#1

Anybody who knows how to clear the text in the Summernote editor when submit function is return false?

I have set my application to stay on the same page when submitting the form, and as a result the text entered in Summernote editor stays there after submit.

Here’s my template event

"submit .message-text": function(event) {
// Prevent default browser form submit
event.preventDefault();

// Get value from form element
var text = $('#summernote').code();
var title = event.target.title.value;
var username = Meteor.userId();
var chatroom = event.target.chatroom.value;
// Insert a task into the collection

Messages.insert({
  text: text,
  title: title,
  chatRoom: chatroom,
  createdBy: username,
  createdAt: new Date() // current time
});
// Clear form
event.target.title.value = "";
}

Summernote is rendered in <div id="summernote"></div>


#2

I figured it out, it was simply to set the value of the div id:

$('#description').code('');