I want to know the last word written or pasted on summernote, below is the code I am using for the same
onkeyup: function (e) {
// CurrentContent = $('#summernote').code();
var CurrentContent = $('#summernote').code().replace(/(<([^>]+)>);/ig, "");
if (e.keyCode == 32) {
PrevContent = CurrentContent.replace(PrevContent, "");
$('#content').text(PrevContent);
PrevContent = CurrentContent;
}
console.log('Key is released:', e.keyCode);
}
<div id="summernote"></div>
<h1>Latest word:</h1>
<div id="content"> </div>
This is not giving me correct result; instead it is giving me something like this when I am typing "Test "
<p>Test </p>
How can i fix it? sorry for my bad english