Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Two conflicting Scripts on Webpage. Need Help


adc

Question

Site URL: https://www.athlytic.io

I'm having an issue with a client site where I am attempting to change the placeholder text on a newsletter block.  I have added the following script to my code injection footer, however, it is not changing:

<script>
  if (document.querySelector("#block-yui_3_17_2_1_1616980347389_14059")) {
    document.querySelector('.newsletter-form-field-element[name="fname"]').placeholder = 'Name';
    document.querySelector('.newsletter-form-field-element[name="lname"]').placeholder = 'Phone Number';
    document.querySelector('.newsletter-form-field-element[name="email"]').placeholder='Email Address';    
  }
</script>

I'm assuming, it's because there is an embedded script within a section on the homepage that is being ran, which hides a portion of content within that section until a button is clicked.  The following code has been applied to the code injection for the home page specifically to get the button to toggle the content on and off

<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>

<style>
.button-section{text-align:center;border-radius:6px;width:350px;display:flex;flex-flow:row wrap;align-items:center;margin:auto;box-sizing:border-box;padding-bottom:35px}

.button-single{text-transform:uppercase;font-size:.7em;text-align:center;letter-spacing:.2em;vertical-align:middle;box-sizing:border-box;width:50%}

.button-left{border-top-left-radius:10px 10px;border-bottom-left-radius:10px 10px}

.button-right{border-top-right-radius:10px 10px;border-bottom-right-radius:10px 10px}
</style>

I need both scripts to work but my knowledge of Javascript is extremely limited and I am struggling getting the newsletter block to display the correct placeholder text for the client.  

Any and all help is extremely appreciated.

Link to post
  • Answers 4
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

Popular Posts

Site URL: https://www.athlytic.io I'm having an issue with a client site where I am attempting to change the placeholder text on a newsletter block.  I have added the following script to my code inj

Posted Images

4 answers to this question

Recommended Posts

  • 0
26 minutes ago, adc said:

Site URL: https://www.athlytic.io

I'm having an issue with a client site where I am attempting to change the placeholder text on a newsletter block.  I have added the following script to my code injection footer, however, it is not changing:

<script>
  if (document.querySelector("#block-yui_3_17_2_1_1616980347389_14059")) {
    document.querySelector('.newsletter-form-field-element[name="fname"]').placeholder = 'Name';
    document.querySelector('.newsletter-form-field-element[name="lname"]').placeholder = 'Phone Number';
    document.querySelector('.newsletter-form-field-element[name="email"]').placeholder='Email Address';    
  }
</script>

I'm assuming, it's because there is an embedded script within a section on the homepage that is being ran, which hides a portion of content within that section until a button is clicked.  The following code has been applied to the code injection for the home page specifically to get the button to toggle the content on and off


<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>

<style>
.button-section{text-align:center;border-radius:6px;width:350px;display:flex;flex-flow:row wrap;align-items:center;margin:auto;box-sizing:border-box;padding-bottom:35px}

.button-single{text-transform:uppercase;font-size:.7em;text-align:center;letter-spacing:.2em;vertical-align:middle;box-sizing:border-box;width:50%}

.button-left{border-top-left-radius:10px 10px;border-bottom-left-radius:10px 10px}

.button-right{border-top-right-radius:10px 10px;border-bottom-right-radius:10px 10px}
</style>

I need both scripts to work but my knowledge of Javascript is extremely limited and I am struggling getting the newsletter block to display the correct placeholder text for the client.  

Any and all help is extremely appreciated.

I saw you made it changed, what's wrong

image.thumb.png.a2b6af1b0e38f9be736d414ef8ccc80d.png

Greeting, it's BaNgan from BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Animated Heading Block
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to post
  • 0

When you click 'Brands' a Newsletter Block appears but it doesn't say:

Name

Phone Number

Email Address

it instead has the default placeholder text for a newsletter block:

First Name

Last Name

Email Address

The code is suppose to change the placeholder text but it doesn't appear that way once the hidden content is revealed upon the button click of the 'Brands' tab.

Link to post
  • 0
On 4/1/2021 at 10:47 AM, adc said:

When you click 'Brands' a Newsletter Block appears but it doesn't say:

Name

Phone Number

Email Address

it instead has the default placeholder text for a newsletter block:

First Name

Last Name

Email Address

The code is suppose to change the placeholder text but it doesn't appear that way once the hidden content is revealed upon the button click of the 'Brands' tab.

It looks like you solved this? 

On tablet, looks huge spacing. Do you want to adjust it?

image.thumb.png.c124e8c314c1d3d6c979f268d409dd79.png

Link to post
  • 0

This issue has not been solved.  Please see attached images to better understand what I'm referring to.

If you would like to provide the code to adjust the spacing for tablet you can just for my better understanding, but the client has not requested that be changed.

Thanks.

Screen Shot 2021-04-05 at 9.24.54 AM.png

Screen Shot 2021-04-05 at 9.24.59 AM.jpg

Link to post

Create an account or sign in to comment

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


×
×
  • Create New...