index.ts 952 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { setupSearch } from './search'
  2. document
  3. .querySelectorAll('[data-ol-contact-form-with-search]')
  4. .forEach(setupSearch)
  5. document
  6. .querySelectorAll('[data-ol-open-contact-form-modal="contact-us"]')
  7. .forEach(el => {
  8. el.addEventListener('click', function (e) {
  9. e.preventDefault()
  10. })
  11. })
  12. document
  13. .querySelectorAll('[data-ol-open-contact-form-modal="general"]')
  14. .forEach(el => {
  15. el.addEventListener('click', function (e) {
  16. e.preventDefault()
  17. })
  18. })
  19. document.querySelectorAll('[data-ol-contact-form]').forEach(el => {
  20. el.addEventListener('submit', function () {
  21. const emailInput = document.querySelector<HTMLInputElement>(
  22. '[data-ol-contact-form-email-input]'
  23. )
  24. const thankYouEmailEl = document.querySelector<HTMLElement>(
  25. '[data-ol-contact-form-thank-you-email]'
  26. )
  27. if (emailInput && thankYouEmailEl) {
  28. thankYouEmailEl.textContent = emailInput.value
  29. }
  30. })
  31. })