Within an .each(function(), I’m trying to uncheck checkboxes.
In line 1, I’m setting the value on 2 different Id’s and this works fine.
What I want to do, is to unset both of the checkboxes on a single line. i.e take lines 3 & 4 and combine into 1 line. Line 2 is what I’ve tried, but it’s not working (it doesn’t do either of them).
(The ‘wsSeq’ is created by the server side, so that I get unique ID’s on multiple rows).
$('#wsDocRef,#wsSupp').val('');
// $("'#wsTransferToQuarantine" + wsSeq + ",#wsTransferToSupplier" + wsSeq + "'").attr('checked', false);
$('#wsTransferToQuarantine' + wsSeq).attr('checked', false);
$('#wsTransferToSupplier' + wsSeq).attr('checked', false);
That isn’t too far off, except for the unnecessary quotes. If
wsSeqis1, your selector looks like this:Which is fine, except for the
'at each end. This should work fine:With all that said, however, it may actually be quicker to do two ID selections than one multiple selection. This kind of optimisation is probably not necessary or a good use of your time.