Jump to content

ishtiyaqali98

Member
  • Posts

    1
  • Joined

  • Last visited

Everything posted by ishtiyaqali98

  1. This is the only code I've tried that actually worked. And FYI, you can find data-form-id in developer mode in chrome when you are creating the custom form in products inventory. Essentially, when you click add to cart and inject js code, our code executes before the form is shown. That's why it never finds the ID. Adding a settimeout, is the only way to get access to the elements within the custom form. No other way around it. var addtocart = document.getElementsByClassName("sqs-add-to-cart-button")[0]; addtocart.style.backgroundColor="yellow"; addtocart.onclick = function(){ console.log("hello"); setTimeout(function() { const buttonToDisable = document.querySelector('[data-form-id="5fb82d8ab2dc2c20b7469fe2"] input[type="submit"]'); console.log(buttonToDisable); }, 1000);
×
×
  • 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.