Note that there are some explanatory texts on larger screens.

plurals
  1. POInput encoding issue with a jquery word counter
    primarykey
    data
    text
    <p>Alright, so I have this script here jsfiddle.net/CDLtn/2/<br> 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.</p> <pre><code>$(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'); }); }); </code></pre> <p>I've found an open source counter <a href="http://roshanbh.com.np/2008/10/jquery-plugin-word-counter-textarea.html" rel="nofollow">http://roshanbh.com.np/2008/10/jquery-plugin-word-counter-textarea.html</a> and this one does accept Russian input ( here is a fiddle of the link above jsfiddle.net/Joniniko/TyPSJ/ ) </p> <p>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.</p> <p>Here is an example of russian text just incase "Привет как дела"</p> <p>(My source page encoding has been changed to UTF-8 already, and ive also tried other ones for cyrillic input) </p> <p>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</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload