Echo JS 0.11.0

<~>
AmrMohNabil 1692 days ago.
Hi All;
I have a form with inputs created dynamically. Their names are generated like
newpackqty1, newpackqty2, newpackqty3, and so on.
I am trying to validate that at least on of these controls, has value this is my Code
for (let i = 1; i <= parseInt(lblCount.value); i++) {
let newqty = 'newpackqty'+i.toString();
if ($("input[name=newqty]").val() == 0) {
noSrcLabels = true;
break;
}

tracker1 1691 days ago. link 1 point
I'd suggest posting on stack overflow.

That said..

    const checks = Array.from(
      document.querySelectorAll('input[name^=newpackqty]')
    );
    const noSrcLabels = !checks.find(el => ~~el.value);

the first one gets all inputs with a name that starts with newpackqty, and the second checks to find if one has a numeric value that is not 0, and inverts the rsult (!).