网址提交
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/* ============================================================
|
||||
HESU — Contact Us page (vanilla JS, no dependencies)
|
||||
· inquiry form: client-side validation + success state
|
||||
(static site — no backend, form does not send anywhere yet)
|
||||
· scroll reveal is handled by js/main.js (unified)
|
||||
============================================================ */
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var form = document.getElementById('ctForm');
|
||||
var note = document.getElementById('ctNote');
|
||||
if (!form || !note) return;
|
||||
|
||||
form.addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (!form.checkValidity()) {
|
||||
form.classList.add('was-validated');
|
||||
var bad = form.querySelector(':invalid');
|
||||
if (bad) bad.focus();
|
||||
note.textContent = 'Please fill in the required fields marked with *.';
|
||||
note.className = 'ct-note is-err';
|
||||
return;
|
||||
}
|
||||
|
||||
form.classList.remove('was-validated');
|
||||
form.reset();
|
||||
note.textContent = 'Thank you for your inquiry. For a quicker response you can also reach us via TEL/WhatsApp: +8613526635577.';
|
||||
note.className = 'ct-note is-ok';
|
||||
});
|
||||
|
||||
form.addEventListener('input', function () {
|
||||
if (note.textContent) { note.textContent = ''; note.className = 'ct-note'; }
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user