I'm trying to count two variables, and if one is bigger than number 1 show a div, else don't show anything.
I got a column with 10 inputs, so i wanna check all inputs for the magic word, then count. I just need to show div if x it at least 1 time in one of the inputs. What I'm doing wrong?
var x = 0;
var l = 0;
for (let i = 0; i <= 10; i++) {
$(document).on("keyup change", ".check" + i, function() {
if ($(this).val().match(/magicword/i)) {
l++;
} else {
x++;
}
});
}
if (x >= 1) {
$(".nda").show();
}
is it better to use show() or toggle()? I want if user deletes magicword div to hide again.