
< >脚本
$(文档).Ready (function () {
$('.accordion-container > h3').on('click', function (event) {
event.preventDefault();
// create accordion variables
var accordion = $(this);
var accordionContent = accordion.next('.accordion-content');
// toggle accordion link open class
accordion.toggleClass("open");
// toggle accordion content
accordionContent.slideToggle(250);
});
});
< >脚本
$(文档).Ready (function () {
$.validator.addMethod("customrule", function (value, element, param) {
return this.optional(element) || value === param;
}, "You must answer the question correctly");
$('form#downlaod-paper').each(function () {
var quotesForm = $(this);
// validate signup form on keyup and submit
$(quotesForm).validate({
rules: {
input_math: {
required: true,
customrule: '30'
},
email: {
required: true,
email: true
}
},
messages: {
email: "Please enter a valid email address",
},
submitHandler: function (form) {
if (quotesForm.find("#spamfilter").val() != "") {
// honeypot was populated. don't submit
return false;
} else {
//Ajax Submission
var url = "form_proc.cfm";
var formData = quotesForm.serializeArray();
$.post(url, formData).done(function (data) {
quotesForm.find("input[type=text], input[type=email], textarea").val("");
quotesForm.find('input[type=checkbox]').prop('checked', false);
if (quotesForm.attr('id') == 'download-form') {
window.location = 'thank-you-roth-401k-download.17.htm';
return false;
} else if (quotesForm.attr('id') == 'downlaod-paper') {
window.location = 'thankyoucollegeplanningebook.52.htm';
return false;
}
else {
window.location = 'thank-you-contact.23.htm';
//alert("Thank you! We will be in touch.");
return false;
}
});
return false;
}
}
});
})
$('form#free-consultation-form').each(function () {
var quotesForm = $(this);
// validate signup form on keyup and submit
$(quotesForm).validate({
rules: {
input_math: {
required: true,
customrule: '24'
},
email: {
required: true,
email: true
}
},
messages: {
email: "Please enter a valid email address",
},
submitHandler: function (form) {
if (quotesForm.find("#spamfilter").val() != "") {
// honeypot was populated. don't submit
return false;
} else {
//Ajax Submission
var url = "form_proc.cfm";
var formData = quotesForm.serializeArray();
$.post(url, formData).done(function (data) {
quotesForm.find("input[type=text], input[type=email], textarea").val("");
quotesForm.find('input[type=checkbox]').prop('checked', false);
if (quotesForm.attr('id') == 'download-form') {
window.location = 'thank-you-roth-401k-download.17.htm';
return false;
} else if (quotesForm.attr('id') == 'downlaod-paper') {
window.location = 'thankyoucollegeplanningebook.52.htm';
return false;
}
else {
window.location = 'thank-you-contact.23.htm';
//alert("Thank you! We will be in touch.");
return false;
}
});
return false;
}
}
});
})
});
< >脚本
$(文档).Ready (function () {
// $.validator.addMethod("customrule", function (value, element, param) {
// return this.optional(element) || value === param;
// }, "You must answer the question correctly");
// $('form').each(function() {
// var quotesForm = $(this);
// setTimeout(function() {
// $(quotesForm).attr("action", "form_proc.cfm");
// }, 3000);
// // validate signup form on keyup and submit
// $(quotesForm).validate({
// rules: {
// input_math: {
// required: true,
// customrule: '24'
// },
// email: {
// required: true,
// email: true
// }
// },
// messages: {
// email: "Please enter a valid email address",
// },
// submitHandler: function(form) {
// if (quotesForm.find("#spamfilter").val() != "") {
// // honeypot was populated. don't submit
// return false;
// } else {
// // Direct Submission
// // quotesForm.submit();
// //Ajax Submission
// var url = "form_proc.cfm";
// var formData = quotesForm.serializeArray();
// $.post(url, formData).done(function(data) {
// quotesForm.find("input[type=text], input[type=email], textarea").val("");
// quotesForm.find('input[type=checkbox]').prop('checked', false);
// if (quotesForm.attr('id') == 'download-form') {
// window.location = 'thank-you-roth-401k-download.17.htm';
// return false;
// }else if (quotesForm.attr('id') == 'downlaod-paper') {
// window.location = 'thankyoucollegeplanningebook.52.htm';
// return false;
// }
// else {
// window.location = 'thank-you-contact.23.htm';
// //alert("Thank you! We will be in touch.");
// return false;
// }
// });
// return false;
// }
// }
// });
// })
$('input[name="Phone"]').keyup(function (e) {
if (/\D/g.test(this.value)) {
// Filter non-digits from input value.
this.value = this.value.replace(/\D/g, '');
}
});
});