我有一个购物车结帐页面,我正在尝试添加一个“礼物”选项。需要做什么:一旦选中“将订单作为礼物发送”复选框,需要为隐藏的输入字段分配一个值,以便将信息移动到确认页面和各种收据上。
HTML:
<h3>Send Order As Gift</h3>
<ul>
<li class="fc_row fc_gift"><label for="gift" class="fc_pre">This is a gift,
please do not include a receipt.</label>
<input type="checkbox" name="gift" id="gift" class="checkbox" value="" />
<input type="hidden" name="Gift" id="gift-true" value="" /></li>
<script type="text/javascript">
$(document).ready(function(){
$("#gift-true").input( $('#edit-checkbox-id').is(':checked').val() + "Yes");
});
</script>
</li>
<li class="fc_row fc_gift_message"><label for="Gift Message">Include a message
(limit 100 characters):</label>
<textarea name="Gift Message" cols="50" rows="3" maxlength="100"></textarea>
</li>
</ul>