Guest Posted January 26, 2021 Share Posted January 26, 2021 I'm trying to hide a default Squarespace form caption type when typing with Javascript yet it doesn't seem to work. This must be an issue you must have run into previously. Would really appreciate your help! Here's my Js bit embeded in the code const captionBox = document.querySelector(".caption") captionBox.addEventListener("click", hideCaption); function hideCaption () { const fields = document.querySelectorAll(".field-element") const captionText = document.querySelector(".caption-text") fields.forEach(field => { if (field.classList.contains("focus-visible")) { captionText.style.visibility = "hidden"; } else { captionText.style.visibility = "visible"; } }) } Link to comment
tuanphan Posted February 2, 2021 Share Posted February 2, 2021 Have you wrap code in script tag yet? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.