Check unsubscribe, uncheck everything else

Highlighted
Anonymous
Not applicable

Check unsubscribe, uncheck everything else

Trying to use javascript on our email preference center so when someone checks the "unsubscribe" box, it will automatically uncheck any other boxes on the preference center. However, the script I found on another Community page isn't working. Anybody have any ideas as to why? The script we're using is below:

<script type="text/javascript">
    
    $jQ("#Unsubscribed").click(function() {
        if ($jQ('#Unsubscribed:checked').val() != null) {
        $jQ("input[name=Newsletter],input[name=Webinars],input[name=Events],input[name=Partner],input[name=Catalyst],input[name=Resources]").attr("checked", false);
}
    });
    $jQ("#Newsletter, #Webinars, #Events, #Partner, #Catalyst, #Resources").click(function() {
        if ($jQ('#Unsubscribed:checked').val() != null) {
            $jQ("input[name=Unsubscribed]").attr("checked", false);
        }
    });
</script>
Tags (1)
4 REPLIES 4
Highlighted
Anonymous
Not applicable

Re: Check unsubscribe, uncheck everything else

Hi Sara,
maybe you have other requirements but why don't you use a data management smart campaign to always uncheck all fields in the database when someone unsubscribes?

Best regards

Steffen
Highlighted
Anonymous
Not applicable

Re: Check unsubscribe, uncheck everything else

Hi Steffen,

We thought the java script would be easier, but yes, that will be our workaround!

Thanks!
Sara
Highlighted
Anonymous
Not applicable

Re: Check unsubscribe, uncheck everything else

Hi Sara, 
it's also possible with JavaScript but I think it's not easier. I prefer the Smart Campaign solution because you can anytime modify it without having to change the JavaScript.

Best regards

Steffen
Highlighted
Level 10 - Champion Alumni

Re: Check unsubscribe, uncheck everything else

I agree with Steffen.

Javascript will look slick to the user - but how many will notice or appreciate what you've done? Why bother?

The other option here, which I do sometimes, is to NOT run an Unsubscribe ALL campaign. If they check Unsubscribe=TRUE, then they won't get anything.

If I leave their other settings intact, perhaps if they return to resubscribe, they will want to receive the other options.