Hide the Last Name in a Newsletter Block

What does this code do?

This code snippet will allow you to hide the last name in a Newsletter Block. Take note that subscribers in your email system will have a last name of “-”.

 

Code Snippets

Javascript

Copy and paste this code into the Footer Code Injection.

<!-- Hide Last Name in Newsletter Block -->
<script> 
(function () {  
  var lastName = document.querySelectorAll(".newsletter-form .last-name input");
  
  for (var i = 0; i < lastName.length; i++) {
    lastName[i].value = "-";
  }
})();
</script>
 

CSS

Then copy and paste this code into the Custom CSS.

.newsletter-form .last-name {
  display: none !important;
}
 

How To Use It

  1. Copy and paste the code as indicated above.

  2. For more information on where to paste the code, check out our Start Here guide.

Rebecca Grace

Rebecca Grace is a Squarespace CSS Expert and Website Designer.

https://rebeccagracedesigns.com
Previous
Previous

Add Vertical Information or FAQ Tabs

Next
Next

Add Captions to the Gallery Lightbox