Jump to content

Newsletter block last name field

Recommended Posts

  • 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

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

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

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

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...
  • 5 months later...
On 2/15/2022 at 2:29 AM, 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>

 

Hey @tuanphan I tried adding this code to page settings and site wide code injection header but neither seem to have worked. Would you possibly be able to take a look please?

Newsletter block is at the very bottom of the page (sorry it's messy – being used for sidebar)

https://beehyve.squarespace.com/sidebar-2
password:abc

Thanks so much! 🙂 

Edited by melaniejaane
update link + password
Link to comment
On 6/1/2023 at 11:51 AM, melaniejaane said:

Hey @tuanphan I tried adding this code to page settings and site wide code injection header but neither seem to have worked. Would you possibly be able to take a look please?

Newsletter block is at the very bottom of the page (sorry it's messy – being used for sidebar)

https://beehyve.squarespace.com/sidebar-2
password:abc

Thanks so much! 🙂 

Hi,

Add it to Sitewide Code Injection > Footer

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
On 6/7/2023 at 5:03 AM, melaniejaane said:

Hey @tuanphan I've tried adding it to the Footer but it's still not working. Any idea why?

Thanks again 🙂 

Try this new code. If it still doesn't work, keep the code in Code Injection, then we can check it easier

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script src="https://storage.googleapis.com/squarestylist/translate-style.js"></script>
<script>
$(document).ready(function(){
	$('.last-name input').attr('value','NA');
  $('.last-name').attr('style','display:none;');
  $('.first-name input').attr('placeholder',' ');
  $('.email input').attr('placeholder',' ');
});
</script>

 

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
  • 4 weeks later...
On 7/2/2023 at 7:05 PM, LillianC said:

Hello how do I remove the last name field from the newsletter in the footer of all pages on this website? None of the code above is working for me

https://www.rooftopbar.co/about

This code should work, I tested it again last night.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
	$('.last-name input').attr('value','NA');
  $('.last-name').attr('style','display:none;');
});
</script>

 

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
On 7/2/2023 at 7:05 PM, LillianC said:

Hello how do I remove the last name field from the newsletter in the footer of all pages on this website? None of the code above is working for me

https://www.rooftopbar.co/about

The url doesn't exist

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

Sorry, the page was hidden. The newsletter sign up block on the footer of every page on this website? https://www.rooftopbar.co/

 

I;ve added in your code above, is there a way to get first name , email address sitting closer to the white underline? Also this new code as made the Email address text much larger than First name. How can I style the same?

Edited by LillianC
Link to comment
9 hours ago, LillianC said:

Sorry, the page was hidden. The newsletter sign up block on the footer of every page on this website? https://www.rooftopbar.co/

 

I;ve added in your code above, is there a way to get first name , email address sitting closer to the white underline? Also this new code as made the Email address text much larger than First name. How can I style the same?

Use this code under

footer.sections .newsletter-form-body input {
    padding-bottom: 0px !important;
}

footer.sections .newsletter-form-body .form-fields input {
    font-size: 16px !important;
}

 

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

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.