2011-08-07 7 views
0

私は以下の2つのコード・ソースを含めました。ラジオ・リスト・ボタンのチェックを外し、選択したラジオ・リスト・ボタンをチェックしています - Jquery

ラジオボタン(ラジオグループがボタングループのID)の1つをクリックすると、以前に「チェック済み」オプションが選択解除されず、新しい「チェック済み」オプション選択されません。その代わりに、セレクターのクリックイベントが発生し、 'チェックされた'オプションは同じままです。

これを修正するにはどうすればよいですか?私は新しいオプションが 'チェック'され、Javascript経由でそのオプションをチェックするときはいつでも 'チェックされた'オプションをクリアしようとしましたが、成功していません。

思考?

ありがとうございます!

Javascriptコード:

$(function() { 

$("#paid-content-box").hide(); 
$("#general-settings").show(); 
$("#individual-box-prices").hide(); 
$("#paypal-preference").hide(); 

$("#general-settings-link a").click(function() { 
    $("#paid-content-box").hide(); 
    $("#general-settings").show(); 
    return false; 
}); 

$("#paid-content-settings-link a").click(function() { 
    $("#paid-content-box").show(); 
    $("#general-settings").hide(); 
    return false; 
}); 

$("input#somepaid").click(function() { 
    document.forms['paidContentForm'].elements['perbox'].disabled = true; 
    $("#individual-box-prices").show(); 
    $("#paypal-preference").show(); 
    return false; 
}); 

$("input#allfree").click(function() { 
    document.forms['paidContentForm'].elements['perbox'].disabled = true; 
    $("#individual-box-prices").hide(); 
    $("#paypal-preference").hide(); 
    return false; 
}); 

$("input#subscription").click(function() { 
    document.forms['paidContentForm'].elements['perbox'].disabled = false; 
    $("#individual-box-prices").hide(); 
    $("#paypal-preference").show(); 
    return false; 
}); 

})。

HTML/PHPコード:

<div id="paid-content-box" align="left"> 
<form name="paidContentForm" action="" method="post"> 
<h2>Set Your group/Box Prices</h2> 
<div id="radio-group" class="radiogroup"> 
<input id="allfree" type="radio" name="boxprices" value="allfree" checked><label for="allfree">All boxes are free.</label><br /> 
<input id="subscription" type="radio" name="boxprices" value="subscription"><label for="subscription">Subscription pricing (all paid).</label> 
<label for="perbox">Enter price per box: $</label><input id="perbox" type="text" name="subscriptionpriceper" disabled="true"><br /> 
<input id="somepaid" type="radio" name="boxprices" value="somepaid"><label for="somepaid">Some of the boxes are free and some our paid content. (Please set the price for each box in the textboxes that will appear below.)</label> 
</div> 
<div id="individual-box-prices"> 
<h3>Set Individual Box Prices</h3> 
<table id="pricetable"> 
<tr> 
<th>Box Name</th> 
<th>Free/Paid</th> 
<th>Price</th> 
</tr> 

<? foreach($boxInfo as $newBox){ ?> 
    <tr> 
    <td><? echo $newBox['name']?></td> 
    <td><span id="box_<? echo $newBox['id']?>_free">Free</span> | <span id="box_<? echo $newBox['id']?>_paid"><a href="javascript:freePaidOption(<? echo $newBox['id']?>, 'paid')">Paid</a></span></td> 
    <td><label for="box_<? echo $newBox['id']?>_price">$</label><input id="box_<? echo $newBox['id']?>_price" type="text" name="box_<? echo $newBox['id']?>_price" value="" disabled="true"></td> 
    </tr> 
    <input type="hidden" name="defaultFreePaid_<? echo $newBox['id']?>" value=""/> 
<? } ?> 

</table> 
</div> 
<div id="paypal-preference"> 
<h3>Payment Preferences</h3> 
<label for="paypalemail">Enter your PayPal account email address:</label><input type="text" id="paypalemail" name="paypalemail"> 
</div> 
<br /><br /> 
<input type="submit" name="SavePaidContent" value="Save" class="inputText"> 
</form> 
</div> 

答えて

0

あなたのイベントハンドラのすべてがfalseを返します。これにより、選択したラジオボタンを変更するデフォルトのアクションが防止されます。

+0

私はIDIOTです。ご協力いただきありがとうございます。私は狂っていた。 – user554095

関連する問題