2
我與Twitter的引導按鈕的形式如下JQuery的 - 單選按鈕CSS不刷新後提交
<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>
一旦提交,形式成功提交該數據並刷新以及除單選按鈕的所有其他元素。
我搜索了各種選項,並沿着道具功能。它幫助我解決了內部選擇器的問題。用戶頁面上的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,使其不顯示,如果它不被檢查。
感謝您的答覆ricaldo,但其仍然沒有工作! prop('checked',false)實際上取消了內部收音機的檢查。然而,頁面中的CSS並不會丟失。因爲當我嘗試重新提交單選按鈕提交時未經檢查! – Rico 2013-04-22 22:14:33
請更新問題以反映您實際尋找的內容。 – ricardohdz 2013-04-22 22:21:39
已更新。希望它現在清除 – Rico 2013-04-23 20:02:34