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
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

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: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. 
Content: Links in my posts may refer to SF Digital products or may be affiliate links.
If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too.

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.