Newsletter Preferences Form Auto Selecting all checkboxes
Hello,
So currently my companies communication preferences page auto-selects all newsletters we have even when they are not subscribed. This is probably a simple fix, but I need some help with implementing a javascript line to deselect all boxes except the ones they're subscribed to. Someone from HubSpot gave our marketing agency a script to use but it de-selects all boxes including the ones the contact is subscribed to, we need it to select the ones they are already subscribed to and not the ones they haven't subscribed to.
Since your looping through the checkboxes, you can't check by the elements above. So you won't find .item-inner and .highlighted-subscription. You can only check by the input element itself. So to check if an checkbox is checked you can use this code. But this code will only tel the console if it's checked of not so you have to adjust your code yourself to tell it what to do.
Newsletter Preferences Form Auto Selecting all checkboxes
I tried using the class 'item-inner highlighted-subscription selected' and that did not work. Could you point me in the direction of the correct class to use? Thank you for your help!
<div class="item-inner highlighted-subscription selected">
<div class="checkbox-row">
<span class="fakelabel">
<input id="id_19944038" type="checkbox" name="id_19944038" checked="">
<span>CI Morning Impact | Katy</span>
</span>
</div>
<p>Our daily email newsletter keeps you informed with the latest information about local development, transportation, business openings and other news impacting Katy.</p>
</div>