我試圖將單選按鈕值傳遞給cookie並單擊刷新我的頁面。我的代碼:單擊單選按鈕後如何設置cookie和刷新頁面?
Inheritance Line:
<label><input name='inheritanceline' type='radio' value="father" checked ></input>Father</label>
<label>
<input name='inheritanceline' type='radio' value="mother"></input>Mother</label>
$("input:radio[name=inheritanceline]").change(function() {
if ($(this).attr("checked") == "checked") {
$.cookie('inheritanceline', $(this).val());
}
window.location.reload();
});
但它不起作用,因爲頁面沒有刷新點擊後。我應該如何更改我的代碼才能正常工作?
你應該認真升級你的jQuery版本 –