I have setup a div for the summernote to alter text pulled from a database.
I think it is better to handle the onChange event.
v0.7.0
$('#summernote').summernote({
callbacks: {
onChange: function(contents, $editable) {
console.log('onChange:', contents, $editable);
}
}
});
$(document).ready(function(){
$("#summernote").summernote(
{
height: "10em",
callbacks: {
onChange: function (contents, $editable) {
var code = $(this).summernote("code");
$("#lawsContent").val(code);
}
}
}
);
});
#lawsContent
{
width: 100%;
height: 10em;
}
Editor:
Output:
v0.6.5
As of this version, callback only works with camel case string.
$('#summernote').summernote({
onChange: function(contents, $editable) {
console.log('onChange:', contents, $editable);
}
});
$(document).ready(function(){
$("#summernote").summernote(
{
height: "10em",
onChange: function (contents, $editable) {
$("#lawsContent").val(contents);
}
}
);
});
#lawsContent
{
width: 100%;
height: 10em;
}
Editor:
Output: