Jump to content

Adding codeblock makes my site bugged and text out of whack!

Recommended Posts

  • hasher22 changed the title to How to add more postcodes to JS/HTML?
  • Replies 3
  • Views 434
  • Created
  • Last Reply

EDIT: Fixed! Idiot me had "</div>" all over the middle section, deleted those and site working fine!

Hello,

I added a simple code block with no CSS and no JS and it's making my site bug up.

For example, text spacing and height changes, button padding changes automatically. But when I remove the code block, everything goes back to normal.

My code block below. There are different IDs because I need them when I generate my JS for selected postcodes that are valid or not

<div class="postcode-checker"> 
  <div>
	<p>Enter your NSW postcode to check if we deliver in your area: <input type="text" id="postcode" placeholder="Postcode..."></p>
    <p id="wedeliver" style="display:none;" >
       <strong>Yes, we deliver in your area!</strong>
    </p>
    <p id="wedeliver1" style="display:none;" >
       <strong>Yes, we deliver in your area!</strong>
    </p>
    <p id="wedeliver2" style="display:none;" >
       <strong>Yes, we deliver in your area!</strong>
    </p>
    
    <p id="nodeliver" style="display:none;" > <strong>Sorry, we currently do not deliver to your area.</strong>
  </p>
  </div>
      <p id="nodeliver1" style="display:none;" > <strong>Sorry, we currently do not deliver to your area.</strong>
  </p>
  </div>
    <p id="nodeliver2" style="display:none;" > <strong>Sorry, we currently do not deliver to your area.</strong>
  </p>
  </div>
    <p id="nodeliver3" style="display:none;" > <strong>Sorry, we currently do not deliver to your area.</strong>
  </p>
  </div>

  <p id="errormsg" style="display:none;" >
      Please enter a valid NSW postcode
    </p>
    <p id="errormsg1" style="display:none;" >
      Please enter a valid NSW postcode
    </p>
</div>

 

Link to comment
  • hasher22 changed the title to Adding codeblock makes my site bugged and text out of whack!
12 hours ago, hasher22 said:

I want to implement this on my website (postcode checker on codepen). How do I add more post codes in JS without adding new a new $ line for each post code?

I guess you want to show customers if you deliver to their NSW postcode? To how many postcodes do you deliver?

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Link to comment
12 hours ago, paul2009 said:

I guess you want to show customers if you deliver to their NSW postcode? To how many postcodes do you deliver?

Hey,

Thanks for the message, I implemented the way I wanted it on my website.

Just found out the restricted areas here are only for USA and Canada. Had to find a work around

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.