私は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");
}
});