目前,我有一个带有几个JS按钮的页面和一个按钮下面的CF7联系人表单。
我在这个页面上有一个字段,它显示由按钮<input type="number" id="price"/>设置的值。
我想知道是否有一种简单的方式在CF7电子邮件中使用类似于document.getElementById('price').value的东西发送价格值
会很感激你的帮助!
发布于 2018-10-08 00:10:59
您可以在cf7中为价格创建隐藏字段:
// hidden was css class for hidding field, id is your input price id for cf7
[number price class:hidden id:price_to_send]然后,从cf7以外的输入价格增加到隐藏字段中。
$('#price').change(function() {
$('#price_to_send').val($(this).val());
});注意:如果需要在发送之前验证输入,可以使用wpcf7_before_send_mail操作或其他操作/筛选器:http://hookr.io/plugins/contact-form-7/4.7/
https://stackoverflow.com/questions/50301591
复制相似问题