Jump to content

[Share] Click button - show different newsletter

Recommended Posts

Posted (edited)

If you have any problems or can't do this on your site, you can comment below or message me. I can help easier.

Suppose we need to create something like this, when users click on each button >> show corresponding newsletter block.



#1. First, add 2 Button Blocks and 2 Newsletter Blocks


#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 this free tool to find ID of 2 Newsletter Blocks


In my example, we will have

  • Newsletter 1: #block-7410df8c50a7724d4fcc
  • Newsletter 2: #block-3b3a7f22b741c66555b9


#4. Use this code to Code Injection > Footer (or Page Header Code Injection, page where you use 2 Newsletter Blocks)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
  // For Buyer 
  $("#block-7410df8c50a7724d4fcc").closest('.fe-block').addClass('forbuyer show');
  // For Seller
  // For Buyer 
// For Seller
.forbuyer .newsletter-block, .forseller .newsletter-block {
    display: none;
  .show .newsletter-block {
      display: block !important;
  .show {
      z-index: 999999 !important;
  .active-button {
  background-color: green !important;

#5. Adjust some style

If you want to change Button Style to Checkbox like this


Use this code to Website Tools > Custom CSS

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;


Edited by tuanphan
fix js code

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • Replies 0
  • Views 259
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.