(Squarespace) How to change style of specific button without target Block ID

To change style of specific button block without target Block ID or Button URL.

#1. First, use this code to Code Injection > Footer
If code doesn’t work, you can comment below, message or email me.

<script>
const links = document.querySelectorAll('div.button-block a');
links.forEach(link => {
  const text = link.textContent;
  if (text.includes('##')) {
    link.classList.add('style-button');
    link.textContent = text.replace('##', '').trim();
  }
});
</script>

#2. Use this code to Custom CSS box.

a.style-button {
    background-color: #f1f !important;
    color: #000 !important;
    border: 2px solid green !important;
    border-radius: 0 !important;
}

#3. Edit Button > Enter ## symbol

#4. Now you can target all buttons with ## symbol, use this code or use ID: a.style-button

#5. Result

1 Like