JSFiddle - React, Tailwind, and code Playground
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 () {
if(this.value.length > 2){
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);
});
$.each(wordCounts, function (k, v) {
finalCount += v * x;
}); if(this.value.length == 0){
finalCount = 0;
x = 0;
}
$('#finalcount').val(finalCount)
}).keyup();
$('input:checkbox').change(function () {
$('input[type="text"]:not(:disabled)').trigger('keyup');
});
});