Weird behavior with pre-selected form options
Hi there, we are building a landing page for leads to modify their email preferences (link below)
We built a form that has a series of radio buttons where leads can opt in or out of certain emails, we also have a checkbox at the bottom to completely opt out of all emails in one go. The radio buttons are set to have a default value to opt in for all email options but they only appear to be pre selected in chrome incognito window and safari.
I was also interested in unselecting all the radio buttons if the checkbox is selected and vise versa. So i wrote some javascript on the landing page to do this. Again it works in the incognito window but not in a normal chrome or firefox window. I tried writing some javascript to clear out any form caching but with no luck. Has anyone else had issues with pre-selected values in marketo forms and have a solution they a willing to share. Thanks in advance!
-John
$(document).ready(function() {
$('input[type="radio"]').change(function() {
if ($(this).is(':checked')){ //radio is now checked
$('input[type="checkbox"]').prop('checked', false); //unchecks all checkboxes
}
});
$('input[type="checkbox"]').change(function() {
if ($(this).is(':checked')){
$('input[type="radio"]').prop('checked', false);
}
});
});