【发布时间】:2012-02-01 19:23:08
【问题描述】:
一旦您单击赞成投票,它就会启用,它只能通过单击反对票来禁用。如何做到这一点,如果我单击启用的按钮,它将被禁用。
$("a.vote_down").click(function() {
//get the id
the_id = $(this).attr('id');
//the main ajax request
$.ajax({
type: "POST",
data: "action=vote_down&id="+$(this).attr("id"),
url: "votes.php",
success: function(msg) {
$(".vote_down").addClass("active");
$(".vote_up").removeClass("active");
$("span#votes_count").html(msg);
}
});
});
其中一个链接:
<a href='javascript:;' class='vote_up<?php if($liked["points"]=="1") echo " active";?>' id='<?php echo $id; ?>'>Vote Up</a>
【问题讨论】:
标签: jquery select jquery-selectors