我試圖運行一段代碼只有當一個checkbox
刷新時使用正確的值?jquery複選框上的刷新和唯一值查詢
if ($("input[name='business_group']").attr("checked")==true && .val("accommodation")) {
$(".acc_title").show();
$(".fd_title").hide();
$(".dest_title").hide();
$(".ttt_title").hide();
$(".c_name_container").show();
$(".stay").show();
$(".visit").hide();
alert("accommodation checked");
}
else if ($("input[name='business_group']").attr("checked")==true && .val("food_drink")) {
$(".fd_title").show();
$(".acc_title").hide();
$(".dest_title").hide();
$(".ttt_title").hide();
$(".c_name_container").show();
$(".stay").hide();
$(".visit").show();
alert("food_drink checked");
}
任何想法爲什麼上述代碼不起作用?
簡化您的代碼並添加所有重要的代碼(例如HTML)。並更具體地針對你的問題。 –
順便說一句,你可以發佈你的代碼在jsfiddle.net更容易回答 – JMax