AJPerformance Posted April 21, 2022 Share Posted April 21, 2022 Site URL: https://www.ajpgroup.com/contact-us Hi, I'd like to know if its possible to have the form field titles show inside the fields themselves until your start typing as shown in the picture below. And if possible, can someone show me how i can do it. Thank you! Link to comment
Beyondspace Posted April 21, 2022 Share Posted April 21, 2022 2 hours ago, AJPerformance said: Site URL: https://www.ajpgroup.com/contact-us Hi, I'd like to know if its possible to have the form field titles show inside the fields themselves until your start typing as shown in the picture below. And if possible, can someone show me how i can do it. Thank you! I think we can achieve it with some Js code to set placeholder for input element BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace (+100 Spark plugin customisations) 🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
AJPerformance Posted April 22, 2022 Author Share Posted April 22, 2022 14 hours ago, bangank36 said: I think we can achieve it with some Js code to set placeholder for input element im not very versed with Js so if you dont mind, can you help me figure it out please? Link to comment
Beyondspace Posted April 22, 2022 Share Posted April 22, 2022 29 minutes ago, AJPerformance said: im not very versed with Js so if you dont mind, can you help me figure it out please? You can try the following code in Home > Settings > Advanced > Code Injection, choose the footer <script> (function() { window.addEventListener('DOMContentLoaded', () => { const placeholders = document.querySelectorAll('.field'); if(placeholders.length) { placeholders.forEach(holder => { const inputEl = holder.querySelector('input, textarea.field-element'); const labelEl = holder.querySelector('.caption-text, .title').innerText; if(inputEl && labelEl) { inputEl.setAttribute('placeholder', labelEl); } }) } }); })() </script> Let me know how it works on your site AJPerformance 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace (+100 Spark plugin customisations) 🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
Beyondspace Posted April 22, 2022 Share Posted April 22, 2022 My testing BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace (+100 Spark plugin customisations) 🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
AJPerformance Posted April 22, 2022 Author Share Posted April 22, 2022 2 hours ago, bangank36 said: You can try the following code in Home > Settings > Advanced > Code Injection, choose the footer <script> (function() { window.addEventListener('DOMContentLoaded', () => { const placeholders = document.querySelectorAll('.field'); if(placeholders.length) { placeholders.forEach(holder => { const inputEl = holder.querySelector('input, textarea.field-element'); const labelEl = holder.querySelector('.caption-text, .title').innerText; if(inputEl && labelEl) { inputEl.setAttribute('placeholder', labelEl); } }) } }); })() </script> Let me know how it works on your site It works perfectly, thank you bangank :))) Beyondspace 1 Link to comment
MaureenC Posted April 5, 2023 Share Posted April 5, 2023 I tried this but it still shows the fields above the box as well and not like the original image where the field description is only within the box. Is there a way to do this? Is there also a way to show more of a landscape option similar to image below, rather than it being completely vertical? Link to comment
tuanphan Posted April 8, 2023 Share Posted April 8, 2023 On 4/5/2023 at 8:36 PM, MaureenC said: I tried this but it still shows the fields above the box as well and not like the original image where the field description is only within the box. Is there a way to do this? Is there also a way to show more of a landscape option similar to image below, rather than it being completely vertical? Can you share link to this page? We can check easier 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
DanMorrissey Posted June 13 Share Posted June 13 I used this script on expertsremodeling.com but for some reason it keeps getting stripped out. Any ideas? Link to comment
tuanphan Posted June 15 Share Posted June 15 On 6/13/2024 at 9:35 PM, DanMorrissey said: I used this script on expertsremodeling.com but for some reason it keeps getting stripped out. Any ideas? I see it already worked here, or you mean add space between (required) and text before it? 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
Create an account or sign in to comment
You need to be a member in order to leave a comment