JSFiddle - React, Tailwind, and code Playground
by Rupam Datta
HTML
<input type='checkbox' value='2' name='v'>STS
<br/>
<input type='checkbox' value='4' name='v'>NTV
<br/>
<input class="input1" style="width:350px;" type="text" lang="ru-RU" name="Text_send" id="Text">
<input id="finalcount" value="0" disabled />
JavaScript
$(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);
});
tempCount=0;
for(i=0;i<matches.length;i++){
if(matches[i].length>2){
tempCount++;
}
}
finalCount=tempCount*x;
$('#finalcount').val(finalCount);
}).keyup();
$('input:checkbox').change(function () {
$('input[type="text"]:not(:disabled)').trigger('keyup');
});
});