I have this script here http://jsfiddle.net/slashingweapon/7JmGn/
$(function () {
var wordCounts = {};
$("input[type='text']:not(:disabled)").keyup(function () {
var matches = this.value.trim().split(/\s+/);
wordCounts[this.id] = matches ? matches.length : 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');
});
It is supposed to count the words, and change the value on the right depending if one or more of the checkboxes are checked.
I have 2 issues with it, first is how do i make it display 0 initially instead of 1.
My second issue with it, is that i want it to ignore punctuation and words under specific length (2-3), such as "as,in,no".
EDIT: First issue is solved, thanks to "Karna", but his solution for length does not seem to work for me : http://jsfiddle.net/y4Bp5/1/
Instead it ignores only the first input before space, if its under specific length
EDIT 2: "Rummap Datta"'s solution works, solved.