判断radio是否被选中
$(this).attr(“checked”)==”checked”
$(this).checked
function chooseIdea() {
$(".chooseIdea").live("click", function () {
var ideaId = $(this).attr("data-id");
if ($(this).attr("checked")=="checked") {
var temp_val= $("#chooseItem").attr("data-val");
temp_val=parseInt(temp_val)+1;
$("#chooseItem").attr("data-val",temp_val);
$("#chooseItem").text(temp_val);
var word = "<input type='hidden' class='rel_id' name='relIds' id= " + ideaId + "> ";
$("#hi_d").append(word);
} else {
$("#" + ideaId).remove();
var temp_val= $("#chooseItem").attr("data-val");
temp_val=parseInt(temp_val)-1;
$("#chooseItem").attr("data-val",temp_val);
$("#chooseItem").text(temp_val);
}
if ($(".rel_id").length <= 0) {
$("#chooseItem").text("您还没有选择idea");
return;
}
});
}
还没有评论,来说两句吧...