我有一个jQuery变量,它不工作,它是最喜欢的,因为我不知道如何正确选择元素。我想下面的选择会的工作,但他们没有jquery树遍历不工作
JQUERY:
$('.upVote').click(function(e){
e.preventDefault();
var ratebox = $(this).find('.ratingBox'); //this variable isnt working
var answer_id = $(this).children('.record_id').attr('value'); //this one too
HTML:
<p class='ratingBox'> $answerrating[$f]</p>
<div class='answerBar'>";
<a href='#' class='upVote vote'>Upvote</a>
·
<a href='#' class='downVote vote'>Downvote</a>
<a class='answerTime'> $difference $periods[$j] ago</a>
</div>
<input type='hidden' name='record_id' value='$answerid[$f]' class='record_id' />
谢谢。这是解决方案!我会尽快接受。 – kirby 2012-01-12 16:58:57