以下のようなTwitterブートストラップボタンを備えたフォームがあります
<label class="control-label span3">Status of the Dispute? </label>
<div class="controls span7">
<label class="inline radio">
<input type="radio" id="status" name="status" value="Continue"/> Continue</label>
<label class="inline radio">
<input type="radio" id="status" name="status" value="Resolved"/>Resolved</label>
<label class="inline radio">
<input type="radio" id="status" name="status" value="Referred"/> Referred</label>
<label for="status" class="error">Please tell us the dispute status</label>
</div>
</div>
送信時に、フォームはデータを正常に送信し、ラジオ ボタンを除く他のすべての要素を適切に更新します。
さまざまなオプションを検索し、prop 関数にたどり着きました。内部のセレクターのチェックを外すので、いつか助けてくれました。ユーザー ページの CSS スタイルシートは、選択されているかのように残ります。
$('input[name="status"]').prop('checked', false);
私もこのアイデアを試しました
$('input:not(:checked)').parent().removeClass("inline radio");
しかし、まだ成功していません。
私の完全な送信コードは次のとおりです。
$.validator.setDefaults({
submitHandler: function(form) {
$.post('registermyform.php',
$("#registermyform").serialize(),
function(data)
{
$('#results').html(data);
if (data="yes"){
alert("The new Dispute has been successfully submitted!");
$('#registerDispute')[0].reset();
$('input[name="status"]').prop('checked', false);
$('input:checked').parent().removeClass("inline radio");
}
else {
alert("not submitted!");
}
});
}
});
手伝ってください。チェックされていないのにチェックされているように見えないように、ラジオボタンのCSSを削除したい。