elm = ('cbProducts' + suffix);
_ctl = document.forms[0].elements[elm];
This works when there are more than 1 checkbox in my list.
But when there are only 1, _ctl is undefined.
Would rather use jQuery if possible and have something like:
elm = ('cbProducts' + suffix).trim();
_ctl = $("form :input #cbProducts*");
Next step is assigning length of _ctl (_ctl.length) but it is null for only 1 checkbox in the elements collection.
So you want all inputs whose ids start with
cbProducts?or do you want inputs with
cbProductsanywhere in the id?and of course
_ctl.lengthwill give you the number of elements in this set.EDIT
Based on your comment, if you know the id you’re looking for, instead of this:
opt for this