我有这样的jQuery代码工作正常,但在最后的影像是不会改变到我这里指定的SRC:更改jquery中的图像?
的jQuery:
$(document).ready(function() {
$("a.vote_up").click(function(){
//get the id
var the_id = $(this).attr('id');
//the main ajax request
$.ajax({
type: "POST",
data: "action=vote_up&id=" + the_id,
url: "ajax/votes.php",
success: function(msg) {
$("span.vote_count#"+the_id).html(msg).fadeIn();
// my problem is here
$(".vote_up#" + the_id + " img").attr("src", "img/upvoteActive.png");
}
});
});
});
html代码:
<a href='#' class='vote_up' id="$id"><img src="img/uparrow.png" /></a>
虽然这仍然deosnt工作! :((对不起 – getaway 2010-10-05 19:01:23
+1;只是因为它不适用于你,所以没有必要投票,因为答案仍然是一个好的点 – Mottie 2010-10-05 19:06:24
但它不相关,他应该使用评论系统,它不是一个答案,它的建议!!! – getaway 2010-10-05 19:07:17