I have setup a div for the summernote to alter text pulled from a database.
<div id="summernote" class="form-control"><?php echo $laws['content']; ?></div>
$(document).ready(function() {
$('#summernote').summernote({
height: 300,
});
});
directly following the div I have a text area with an ID.
<textarea id="lawsContent"></textarea>
I want the content of the textarea to change as I type in the summernote div. Just like what is happening while I am typing this question.
Using the summernote API
I came up with this solution:
$(document).ready(function() {
$('#summernote').summernote({
onKeyup: function(e) {
$("#lawsContent").val($("#summernote").code());
},
height: 300,
});
});
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