Demo: https://tuanphan-demo01.squarespace.com/click-text-show-code-block-v2?noredirect
Password: abc
#1. First, you add a Text Block, with these URLs.
Make sure the option “Open link in new tab” is disabled
- #code01
- #code02


and 2 Code Blocks below

#2. Install Squarespace ID Finder and find the ID of all blocks
In my example, we will have:
- Text Block: #block-yui_3_17_2_1_1711157606982_34357
- Code Block 01: #block-yui_3_17_2_1_1711157606982_36018
- Code Block 02: #block-yui_3_17_2_1_1711157606982_36455

#3. Use this 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(){
// Code 01
$("#block-yui_3_17_2_1_1711157606982_36018").closest('.fe-block').addClass('code01 show');
// Code 02
$("#block-yui_3_17_2_1_1711157606982_36455").closest('.fe-block').addClass('code02');
// Code 01
$('a[href="#code01"]').click(function(){
$(".code01").addClass("show");
$('.fe-block:not(.code01)').removeClass('show');
}
);
// Code 02
$('a[href="#code02"]').click(function(){
$(".code02").addClass("show");
$('.fe-block:not(.code02)').removeClass('show');
}
);
});
</script>
<style>
.code01 .code-block, .code02 .code-block {
display: none;
}
.show .code-block {
display: block !important;
}
.show {
z-index: 999999 !important;
}
</style>

#4. Explain code
