Jump to content

Code to default state/country and hide country no longer work

Recommended Posts

Since May 2020, I had used the code below in "Code Injection" to default the State and Country fields, and then hide the Country fields for all of the forms on my site.  But it seems that Squarespace had an update a few months ago that broke this.   I'd like to know what I can do (code changes) to get that functionality back.  Below is the code I used and source.

<!--added by MOAKES 5/24/20 from https://forum.squarespace.com/topic/141931-autofill-country-field-in-form-on-index-page/#comment-183491 --> 
 <script>
     Y.on("domready", function(){
     Y.all('input[name="state"]').setAttribute("value", "GA");
     Y.all('input[name="country"]').setAttribute("value", "USA");  
     });
</script>
<style>
   .field.country {
      display: none;
   }
</style>
<!--  End MOAKES -->

 

Link to comment
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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.