Jump to content

Newsletter block last name field

Recommended Posts

You can't remove Last name field unless using JavaScript (Need a Business Plan).

If you use Business Plan, you can share link to page where you use newsletter block, I can take a look.

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
  • 2 months later...
On 8/9/2020 at 12:52 AM, taylorlaidlaw said:

Hi Tuan, 

How do I delete the last name field on all of the newsletter blocks on this site?

https://grape-gerbil-aby9.squarespace.com/

password: hustle

Thank you!!

Add to Page Settings > Advanced > Header

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
 const lnames = document.querySelectorAll('.last-name input')
   const lnameFields = document.querySelectorAll('.last-name')
  $(document).ready(function(){

     lnames.forEach(lname => {
   lname.value = "-"
  })

     lnameFields.forEach(lnameField => {
     lnameField.style.display = "none"
  })
      
     
 });
</script>

 

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
  • 1 year later...
On 2/10/2022 at 12:30 AM, BxDesign said:

Hello @tuanphan,

Just used your script to remove the last name on a newsletter form and it worked perfectly!

Is there any way to tweak it so it doesn't affect a regular contact form where the last name could be required?

 

Thank you so much :)

try this new code

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
 const lnames = document.querySelectorAll('.newsletter-block .last-name input')
   const lnameFields = document.querySelectorAll('.newsletter-block .last-name')
  $(document).ready(function(){

     lnames.forEach(lname => {
   lname.value = "-"
  })

     lnameFields.forEach(lnameField => {
     lnameField.style.display = "none"
  })
      
     
 });
</script>

 

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
  • 2 weeks later...
On 2/14/2022 at 2:29 PM, tuanphan said:

try this new code

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
 const lnames = document.querySelectorAll('.newsletter-block .last-name input')
   const lnameFields = document.querySelectorAll('.newsletter-block .last-name')
  $(document).ready(function(){

     lnames.forEach(lname => {
   lname.value = "-"
  })

     lnameFields.forEach(lnameField => {
     lnameField.style.display = "none"
  })
      
     
 });
</script>

 

Worked perfectly, thank you so much 🙂

Link to comment
  • 10 months later...

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.