Javascript 单选按钮复制到文本字段的值
我终于想出了如何应用j-query来计算联系人表单7的单选按钮格式。我遇到的问题是,我必须将mini session$100.00的格式反转为100.00 mini session,才能进行计算。我想要100美元的迷你课程。我还想将选中的单选按钮的值复制到文本字段 这是我的表格,它是在联系表格7 formmat中创建的Javascript 单选按钮复制到文本字段的值,javascript,email,get,contact-form-7,Javascript,Email,Get,Contact Form 7,我终于想出了如何应用j-query来计算联系人表单7的单选按钮格式。我遇到的问题是,我必须将mini session$100.00的格式反转为100.00 mini session,才能进行计算。我想要100美元的迷你课程。我还想将选中的单选按钮的值复制到文本字段 这是我的表格,它是在联系表格7 formmat中创建的 <p>Your Name (required)<br /> First Name: [text* RYSFN 20/20 id:RYSFN
<p>Your Name (required)<br />
First Name: [text* RYSFN 20/20 id:RYSFN] Last Name: [text* RYSLN 20/20 id:RYSLN]</p>
<p>Your Email (required)<br />
[email* RYSEM id:RYSEM] </p>
<p>Your Phone Number (required)<br />
[text* RYSPN 15/15 id:RYSPN placeholder "(###) - ### - ####"]</p>
<p>Address (required)<br />
Street Address [text* RYSaddress0 55/50]
Address Line 2 [text* RYSaddress1 55/50]
City [text* RYSaddress2 20/20] State [text* RYSaddress3 4/4] Zip code [text* RYSaddress4 7/7] </p>
<p>Session Date<br />
Session date: [text* RYSSD 20/20 id:RYSSD1 placeholder "Month DD YYYY"]</p>
<p>Session Type<br />
[radio RYSYFS id:RYSYFS class:radio-vertical class:wpcf7-list-item-label "Maternity" "Family" "Newborn" "Baby / Toddler / Child" "Cake Smash" "Milestone"]</p>
<p>Session payment Type<br />
[radio RYSSPT id:RYSSPT class:radio-vertical class:wpcf7-list-item-label "100.00 Mini Session" "Full Session $250.00"]</p>
<p>Extra People<br />
[radio RYSEP id:RYSEP class:radio-vertical class:wpcf7-list-item-label "25.00 1 Person" "2 People 50.00 " "3 People 75.00 " "4 People $100.00 "]
<p>Session Products: <br />
Type of session: [text RYSTS 23/23 id:RYSTS1]
Session Payment: [text RYSSP 8/8 id:RYSSP]
Extra people: [text RYSEP 8/8 id:RYSEP]</p>
<p>Session Payment Amount: <br />
Total Amount: [text RYSTotal 8/8 id:RYSTotal]
Deposit Amount: [text RYSDA 8/8 id:RYSDA]
Balance Amount: [text RYSBA 8/8 id:RYSBA]
Balance Due By: [text RYSBDB 20/20 id:RYSBDB]
<p>I under stand this is a non- refundable, transferrable fee required to reserve an session appointment. I under stand this retainer is non-refundable. <br />
[checkbox* RYSAgree "RYSAgree"] </p>
Breakdown Of Payment:
Total Amount: <span id="total"></span>
Deposit Amount: <span id="deposit"></span>
Balance Amount: <span id="balance"></span>
Balance Due By: [text RYSBA2 20/20 id:RYSBA2]
<p>How would you like to pay the remaining balance (due prior to the session) via:<br />
[radio RYSPB id:RYSPB class:radio-vertical "A PayPal Invoice Apx. 2 weeks before the session." "A PayPal Invoice Apx. day before the session." "I will pay the balance the day of the session With a debit or credit card."]
<p>[submit "Send"]</p>
如何将单选按钮的值获取到命名文本字段 $\u GET只检查URL中的查询字符串/?对于变量。查看表单实际提交到的URL 替换整个。。用这个咬
<script>
$(document).ready(function() {
$("#RYSSD1").keyup(function() {
$('#RYSBDB').val($(this).val());
$('#RYSBA2').val($(this).val());
});
var inputs = $('input[name="RYSSPT"], input[name="RYSEP"]');
$(inputs).click(function() {
var total = 0;
$(inputs).filter(':checked').each(function() {
var value = ($(this).val()).match(/\$([0-9]*)/)[1];
total = total + parseInt(value);
})
$('#total').html('$' + total);
$('#deposit').html('$' + (total / 2));
$('#balance').html('$' + (total / 2));
$('#RYSTotal').val('$' + total);
$('#RYSDA').val('$' + (total / 2));
$('#RYSBA').val('$' + (total / 2));
});
$('input[name="RYSYFS"]').click(function() {
$(this).blur();
$('#RYSTS1').val($(this).val());
})
$('input[name="RYSSPT"').click(function() {
$(this).blur();
$('#RYSSP').val($(this).val());
})
$('input[name="RYSEP"').click(function() {
$(this).blur();
$('#RYSEP').val($(this).val());
})
});
</script>
你能再解释一下吗?我不明白你在说什么。这对我来说是全新的,我发现我改变了我的问题,因为我不能再问更多的问题了。可能是我的表单电子邮件的重复,我唯一的事情是联系人表单7中的代码括号我没有得到用HTML写的东西。我不知道如何制作它,这样我就可以得到html格式的内容来发送给我所选内容。如果您的所有输入都不使用CF7,您就不能这样做。您知道我如何将其制作成CF7输入,以便我可以计算它们。。。然后修改jQuery,使之以CF7 outputsok获得的html为目标,将错误的id放在错误的位置进行修复。谢谢。谢谢好的,这就是工作。我如何添加另外两个字段来复制会话付款和额外人员?我只是复制你为收音机准备的内容并将其放在你所拥有的内容下吗?差不多,是的。我再次更新了代码,好吧,我有一个问题,为什么只有当我先有金额,而不是名称,然后是金额100.00 Mini,而不是Mini$100.00,并且我不能得到总数末尾的零,如果它有一个$符号,它将不会成为总数?因为代码使用的是parseInt,它试图将文本转换为一个数字,以便它可以将它们相加,但它只能在文本以数字开头时这样做。如果你想把数字写在最后,我可以用另一种方式来实现吗?
$('#1').blur(function() {
$('#3').val($(this).val());
});
<script>
$(document).ready(function() {
$("#RYSSD1").keyup(function() {
$('#RYSBDB').val($(this).val());
$('#RYSBA2').val($(this).val());
});
var inputs = $('input[name="RYSSPT"], input[name="RYSEP"]');
$(inputs).click(function() {
var total = 0;
$(inputs).filter(':checked').each(function() {
var value = ($(this).val()).match(/\$([0-9]*)/)[1];
total = total + parseInt(value);
})
$('#total').html('$' + total);
$('#deposit').html('$' + (total / 2));
$('#balance').html('$' + (total / 2));
$('#RYSTotal').val('$' + total);
$('#RYSDA').val('$' + (total / 2));
$('#RYSBA').val('$' + (total / 2));
});
$('input[name="RYSYFS"]').click(function() {
$(this).blur();
$('#RYSTS1').val($(this).val());
})
$('input[name="RYSSPT"').click(function() {
$(this).blur();
$('#RYSSP').val($(this).val());
})
$('input[name="RYSEP"').click(function() {
$(this).blur();
$('#RYSEP').val($(this).val());
})
});
</script>