overleaf/services/web/frontend/js/features/contact-form/index.js
Alf Eaton 5f60158e99 Add closing bracket to selector (#18723)
GitOrigin-RevId: ca0966efdd7051d703ab3a6a6eaf6f421f6b7cef
2024-06-12 08:04:31 +00:00

35 lines
991 B
JavaScript

import { setupSearch } from './search'
document
.querySelectorAll('[data-ol-contact-form-with-search]')
.forEach(setupSearch)
document
.querySelectorAll('[data-ol-open-contact-form-modal="contact-us"]')
.forEach(el => {
el.addEventListener('click', function (e) {
e.preventDefault()
$('[data-ol-contact-form-modal="contact-us"]').modal()
})
})
document
.querySelectorAll('[data-ol-open-contact-form-modal="general"]')
.forEach(el => {
el.addEventListener('click', function (e) {
e.preventDefault()
$('[data-ol-contact-form-modal="general"]').modal()
})
})
document.querySelectorAll('[data-ol-contact-form]').forEach(el => {
el.addEventListener('submit', function (e) {
const emailValue = document.querySelector(
'[data-ol-contact-form-email-input]'
).value
const thankYouEmailEl = document.querySelector(
'[data-ol-contact-form-thank-you-email]'
)
thankYouEmailEl.textContent = emailValue
})
})