我有3個單選按鈕[1天,1周,1月],最初1天將被選中。我在隱藏字段中都需要starton和expireon值。 基於用戶選擇,我必須更新starton和expireon值以跨越標籤。這裏的starton值對於所有3個選擇都是相同的,只有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() {
});
});
輸入標籤不能像那樣工作。'' – Popnoodles 2013-05-02 13:08:55