我正在使用 jquery 模板并具有以下 html 标记
<div id="results">
<div class="CommentItem" commentid="33064" id="33064" data-guid="/Profile/Profile.aspx?id=Charliedog33">
<div class="CommentPic">
<img src="AspNetForumAvatarguy18.jpg">
</div>
<div class="CommentText">thsi is text</div>
</div>
<div class="CommentItem" commentid="33064" id="33064" data-guid="/Profile/Profile.aspx?id=Charliedog33">
<div class="CommentPic">
<img src="AspNetForumAvatarguy18.jpg">
</div>
<div class="CommentText">thsi is text</div>
</div>
</div>
它确实在列表中呈现数据,但我如何在单个项目上注册事件。(commentid 确实具有唯一值)
$("#results").live("click", function (evt) {
if ($(this).evt.attr('commentid') != null) {
alert("event registered goes here");
}
else {
alert("there is prolem");
}
});