我有 3 个单选按钮 [1Day, 1Week, 1Month],最初将选择 1day。我在隐藏字段中有所有必需的 starton 和 expireon 值。根据用户选择,我必须将 starton 和 expireon 值更新为 span 标签。这里所有 3 个选择的 starton 值相同,只有 expireon 值会根据单选按钮选择而改变。任何人都可以在这里帮助我完成这项工作。
HTML 代码:
<body>
<input type="hidden" id="startOn" value="01/01/2013" />
<input type="hidden" id="expireDay" value="01/01/2013" />
<input type="hidden" id="expireWeek" value="01/07/2013">
<input type="hidden" id="expireMonth" value="01/31/2012" />
<input type="radio" id="packageAmt1" name="packageAmt" checked="checked">1 Day</input>
<input type="radio" id="packageAmt2" name="packageAmt">1 Week</input>
<input type="radio" id="packageAmt3" name="packageAmt">1 Month</input>
<br/>Start on<span id="startOnValue" /></span>
<br/>Expire on<span id="expireOnValue" /></span>
</body>
jQuery Code:
$(document).ready(function () {
var starton = $('#startOn').val()
var expireday = $('#expireDay').val()
var expireweek = $('#expireWeek').val()
var expiremonth = $('#expireMonth').val()
$('#startOnValue').text(starton);
$('#expireOnValue').text(expireday);
$('input[type=radio]').change(function () {
});
});