Demo: https://tuanphan-demo01.squarespace.com/click-checkbox-show-newsletter?noredirect
Password: abc
Description: Click on each checkbox >> Show the corresponding Newsletter Block
You can follow these steps:
#1. First, add 2 Button Blocks and 2 Newsletters

#2. Edit 2 Button Blocks, and use these URLs:
- #forbuyer
- #forseller
and make sure the option “Open Link in New Tab” is disabled.


#3. Install Squarespace ID Finder to find the ID of Buttons and Newsletters.
In my example, we will have:
- Left Newsletter: #block-3196746584b85649d56f
- Right Newsletter: #block-eb7980909cfcaf195b9a

#4. Use code to Code Injection – Footer (or Page Header Code Injection)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
// For Buyer
$("#block-3196746584b85649d56f").closest('.fe-block').addClass('forbuyer show');
$('a[href="#forbuyer"]').addClass('active-button');
// For Seller
$("#block-eb7980909cfcaf195b9a").closest('.fe-block').addClass('forseller');
// For Buyer
$('a[href="#forbuyer"]').click(function(){
$(".forbuyer").addClass("show");
$('.fe-block:not(.forbuyer)').removeClass('show');
$(this).addClass('active-button');
$('a:not([href="#forbuyer"])').removeClass('active-button');
}
);
// For Seller
$('a[href="#forseller"]').click(function(){
$(".forseller").addClass("show");
$('.fe-block:not(.forseller)').removeClass('show');
$(this).addClass('active-button');
$('a:not([href="#forseller"])').removeClass('active-button')
}
);
});
</script>
<style>
.forbuyer .newsletter-block, .forseller .newsletter-block {
display: none;
}
.show .newsletter-block {
display: block !important;
}
.show {
z-index: 999999 !important;
}
a[href="#forbuyer"]:before, a[href="#forseller"]:before {
content: "\f0c8";
font-family: "Font Awesome 6 Free";
font-weight: bold;
font-size: 20px;
color: #000 !important;
margin-right: 5px;
font-weight: 400;
}
a[href="#forbuyer"], a[href="#forseller"] {
background-color: transparent !important;
color: #000 !important;
}
.active-button:before {
content: "\f14a" !important;
}
</style>

#5. Explain code

