I have the following code but the text from the Div ID para has the last word and first word of the next sentence joined and views it as 1 word instead of 2
Code:
var value = $('#RichHtmlField_displayContent').text();
console.log("text", value)
if (value.length == 0) {
$('#show_word_count').html(0);
return;
}
var wordCount = value.match(/\S+/ig).length
$('#show_word_count').html(wordCount);
};
$(document).ready(function() {
$('#RichHtmlField_displayContent').change(counter);
$('#RichHtmlField_displayContent').keydown(counter);
$('#RichHtmlField_displayContent').keypress(counter);
$('#RichHtmlField_displayContent').keyup(counter);
$('#RichHtmlField_displayContent').blur(counter);
});
So what I want to do is add a space after all full stops, question marks then count the total word.