Vote count:
0
This script counts the characters and words from three separate textarea inputs and echo's out the sum. My variable for the sum of characters (chars_all) is working, however the variable for the sum of words (words_all) is returning the same number.
If I return a single words variable (words1, words2, words3), it works as intended. The issue seems to be in getting the final sum.
Here's the relevant piece of code
setInterval(function(){
var chars1 = $('#content_ifr').contents().find('body').text();
var words1 = chars1.split(" ");
var chars2 = $('#contentsection2_ifr').contents().find('body').text();
var words2 = chars2.split(" ");
var chars3 = $('#contentsection3_ifr').contents().find('body').text();
var words3 = chars3.split(" ");
var chars_all = chars1+chars2+chars3;
var words_all = words1+words2+words3;
$(".textarea_chars_all").text(chars_all.length);
$(".textarea_words_all").text(words_all.length);
}, 2000)
asked 1 min ago
Displaying Sum Of Characters and Sum Of Words
Aucun commentaire:
Enregistrer un commentaire