A Marketo webinar on subscription centers gave us a script to automatically uncheck the individual boxes for different types of news a user could subscribe to (events, promos, product updates) if the user checked the box for "unsubscribe all."
I updated the sample script to match our fields, tested it, and it worked! However, when I added it to my Marketo landing page (which also includes a custom HTML header, Marketo form, and custom HTML footer) inside a HTML box, it not only didn't work but the page didn't even recognize the script. When I approved the page, viewed it, and "inspected element" of the page, the script was nowhere to be found.
Any ideas on what might be overiding my script or something extra I need to do to get the script recognized for that page? Any guidance is much appreciated!
Allison
p.s. Here is the script I'm trying to use:
<script type="text/javascript">
window.onload = function() {
var unsubscribe = jQuery("#Unsubscribed"),
subscriptions = jQuery(".mktoForm input[type='checkbox']:not(#Unsubscribed)");
console.log('running form check script');
console.log(subscriptions);
console.log(jQuery);
unsubscribe.click(function() {
setChecked = unsubscribe.prop('checked') ? false : true;
subscriptions.prop("checked",setChecked);
});
subscriptions.click(function() {
if (unsubscribe.prop("checked"))
unsubscribe.prop("checked", false);
});
}
</script>