Advertisement
ikai2

change position of the form message

Sep 19th, 2022
583
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1- add HTML/Liquid element inside the form, it must be inside the form.
  2. 2- Add this liquid code to the HTML/Liquid element:
  3.  
  4.  
  5. <style>
  6.   .ckxrLb {display: none;}
  7. </style>
  8. {% if form.posted_successfully? %}
  9.     <script>
  10.         window.addEventListener('load', function() {
  11.  
  12.               function insertAfter(newNode, existingNode) {
  13.             existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);
  14.         };
  15.             const contactFormDOM = document.querySelector('.pf_contact_form > form')
  16.             console.log(contactFormDOM.childNodes[0])
  17.             if(contactFormDOM) {
  18.               const pElements = contactFormDOM.querySelectorAll('p');
  19.                 const messageDOM = pElements[pElements.length - 1]
  20.                 insertAfter(messageDOM, contactFormDOM.lastElementChild)
  21.                 messageDOM.style.display = "block";
  22.             }
  23.         })
  24.     </script>
  25. {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement