Alright, so I have this script here jsfiddle.net/CDLtn/2/
that counts up the words and displays a value based on if any of the checkboxes were checked
it works fine except one thing, it doesen't work with Russian input.
$(function () {
var wordCounts = {};
$("input[type='text']:not(:disabled)").keyup(function () {
var matches = this.value.match(/\b/g);
wordCounts[this.id] = matches ? matches.length / 2 : 0;
var finalCount = 0;
var x = 0;
$('input:checkbox:checked').each(function () {
x += parseInt(this.value);
});
x = (x == 0) ? 1 : x;
$.each(wordCounts, function (k, v) {
finalCount += v * x;
});
$('#finalcount').val(finalCount)
}).keyup();
$('input:checkbox').change(function () {
$('input[type="text"]:not(:disabled)').trigger('keyup');
});
});
I've found an open source counter http://roshanbh.com.np/2008/10/jquery-plugin-word-counter-textarea.html and this one does accept Russian input ( here is a fiddle of the link above jsfiddle.net/Joniniko/TyPSJ/ )
I need to either somehow make my original counter work with Russian input, or maybe incorporate the checkbox feature into the one that was made by Roshan.
Here is an example of russian text just incase "Привет как дела"
(My source page encoding has been changed to UTF-8 already, and ive also tried other ones for cyrillic input)
UPD: jsfiddle.net/Joniniko/CDLtn/5/ this accepts the russian input, but it increments the counter by 0.5 instead of 1 for some unknown to me reason