Код: Выделить всё
First Name
Last Name
Company Name (optional)
Address
City
State
Zip
Phone
Email
Would you like to be onsite for the estimate?
please select...
Yes, please call me to schedule time
No, you can drive by to provide an estimate
Subject
Message
class="g-recaptcha"
data-sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"
style="padding: 10px 0"
>
Send Message
document
.getElementById("webleadform")
.addEventListener("submit", async function (e) {
e.preventDefault()
const form = e.target
const formData = Object.fromEntries(new FormData(this).entries())
try {
const response = await fetch(form.action, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(formData),
})
if (response.ok) {
const redirectUrl = formData.RedirectUrl
if (redirectUrl) window.location.href = redirectUrl
} else {
const errorText = await response.text()
alert(`Error submitting form: ${errorText}`)
}
} catch (error) {
console.error("Error submitting form:", error)
alert("A network error occurred. Please try again.")
}
})
var tele = document.querySelector('#Phone');
tele.addEventListener('keyup', function(e){
if (event.key != 'Backspace' && (tele.value.length === 3 || tele.value.length === 7)){
tele.value += '-';
}
});
function autofill(){
var x = document.getElementById('Scheduling').value;
if(x=='Yes')
{
document.getElementById('Message').value= 'PLEASE LEAVE THIS AS PART OF THE MESSAGE (Scheduling Option: please call me to schedule an estimate)';
}
if(x=='No')
{
document.getElementById('Message').value= 'PLEASE LEAVE THIS AS PART OF THE MESSAGE (Scheduling Option: a drive by estimate is preferred)';
}
}
< /code>
Вот сценарий, который я ввел в заголовок сайта: < /p>
Подробнее здесь: https://stackoverflow.com/questions/794 ... -wordpress
Мобильная версия