我有一个如下的 HTML 片段
var useful, cool, funny;
'<ul data-component-bound="true" class="voteset'+data[i]['review_id']+'">'+
'<li class="useful ufc-btn" id="1">'+
'<a href=javascript:vote('+data[i]['review_id']+',"useful") rel="useful"><span>Useful</span></a>'+
'<span>'+useful+'</span>'+
'</li>'+
'<li class="funny ufc-btn" id="2">'+
'<a href=javascript:vote('+data[i]['review_id']+',"funny") rel="funny"><span>Funny</span></a>'+
'<span>'+funny+'</span>'+
'</li>'+
'<li class="cool ufc-btn" id="3">'+
'<a href=javascript:vote('+data[i]['review_id']+',"cool") rel="cool"><span>Cool</span></a>'+
'<span>'+cool+'</span>'+
'</li>'+
'<span class="vote'+data[i]['review_id']+'"></span></ul>'+
'</div>';
每个评论都有 3 个有用、酷和有趣的按钮。当我执行点击操作时,如何增加<span>
每个按钮内的计数。以下是我尝试但不起作用的方法。谢谢
function vote(reviewId,status) {
$('.vote'+reviewId).text('posting ...');
$('.voteset'+reviewId).click(function(){
var updatevote = $(this).find("li>span").text();
updatevote = updatevote + 1;
$(this).next('span').html(updatevote);
});
}