Jump to content

Datedropper javascript lightbox forms

Recommended Posts

Site URL: https://www.fieldandflorist.com/floral-delivery/sendflowers

Hey Ya'll — first off, I have really appreciated this whole community. Thank you for all your input on other user's posts.

I'm fairly new to coding and downloaded a .js date picker called datedropper — beautiful design if you haven't seen it. https://felixg.io/docs/products/datedropper-javascript. I'm trying to figure out how to get it to target and replace the date element in the lightbox form that pops up after you click 'Add to Cart' here: https://www.fieldandflorist.com/floral-delivery/sendflowers

I uploaded the js file to my site and attempted to install it to the header code injection of the page above with the code:

<head>
  ... 
  <!-- datedropper -->
  <script src="datedropper-javascript.js"></script>
</head> 

But I'm struggling to figure out the proper code formatting to get it to target and replace the date element in the lightbox form. The developer's page says to use this:

<input type="date">

<!-- datedropper init -->
<script>
new dateDropper({
  selector: 'input[type="date"]'
});
</script>

I believe that the element id is:

"date-yui_3_17_2_1_1603374970281_230035" class="form-item fields date required'

Any help would be appreciated. I'm super new to all of this. Thank you!

 

Link to comment
  • Replies 1
  • Views 355
  • Created
  • Last Reply

The developer's guide assumes that you adding the control to an element that already exists on the page. However, it's slightly more complex on Squarespace because Product Forms don't exist on the page. They are only created after a selects variants and attempts to add a product to their cart. If they change their mind to select another variant, the code needs to be called again.

If you'd like an alternative datepicker that has been built to work exclusively on Squarespace, including Product Forms, and doesn't require you to understand code, you may find our Datepicker useful. 

For more information and live examples, see the datepicker product page.

date-picker-tile.png.365f2e3ea01477c0f06bb3ae05d3171b.png

 

About me: I'm Paul. A SQSP User for 18 yrs, I joined Circle when it launched in 2016 and have been a Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL, providing expertise and 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 free. You can thank me by clicking one of the feedback emojis below. Coffee fuels my work.

Book paid help with a Squarespace Domain

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.