在特定的单选按钮单击上设置多个表单字段

时间:2012-07-17 11:01:53

标签: php javascript radio-button

我正在开发一个网络应用程序,我将集成一个Paypal帐户。页面上有许多单选按钮代表各种信用,它的价格和智能一样。我的问题是,我想要一些功能,通过它我可以在其中一个单选按钮上设置各种其他形式的字段。每个单选按钮的值都不同。

<form action='<?php echo $paypal_url; ?>' method='post' name='form'>
    <div class="crea_paka_title">Creadit Pakages</div>
    <?php
    foreach($admin_credits as $credits){ 
    ?>
        <div class="creadit_fields">
            <span class="for_radio">
                <input type="radio" name="1" id="<?php echo $credits['AdminCredit']['id'];?>" value="" />
            </span>
            <span class="for_creadit">
                <?php echo $credits['AdminCredit']['tx_total_credits']; ?> Credits
            </span>
            <span class="for_cre_value">
                $<?php echo $credits['AdminCredit']['nu_total_price']; ?>
            </span>
        </div>
        <div style="clear:both;"></div>
    <?php
    }
    ?>
<input type='hidden' name='business' value='<?php echo $paypal_id; ?>'>
<input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='item_name' value='<?php echo $credits['AdminCredit']['tx_total_credits'];?> Credits'>
<input type='hidden' name='item_number' value='<?php echo $credits['AdminCredit']['id'];?>'>
<input type='hidden' name='amount' value='<?php echo $credits['AdminCredit']['nu_total_price'];?>'>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='currency_code' value='USD'>

如上所述,在我的代码中,我要更改单选按钮上的输入值。任何建议表示赞赏。

enter image description here

1 个答案:

答案 0 :(得分:0)

jQuery会这样做:

$("#rbID").click(finction(){
  $("otherRB").attr("checked",true);
});