我试图在点击连接事件时获得隐蔽的实地价值。 这些要素是:
<p>
<a class="showCommentAttachment cboxElement" href="#">Attachments</a>
<input type="hidden" value="13" id="ctl00_ContentPlaceHolder1_lvComment_ctrl3_hfCommentId" name="ctl00$ContentPlaceHolder1$lvComment$ctrl3$hfCommentId">
</p>
这里是完整的标记:
<div id="divComment" class="comment-text">
<div class="comment-author">
David Chart
</div>
<span class="comment-date-time">Sep 29, 2011 08:12:42 PM</span>
<p>
Some comment text goes here. Some comment text goes here.
</p>
<p>
<a class="showCommentAttachment cboxElement" href="#">Attachments</a>
<input type="hidden" value="13" id="ctl00_ContentPlaceHolder1_lvComment_ctrl3_hfCommentId" name="ctl00$ContentPlaceHolder1$lvComment$ctrl3$hfCommentId">
</p>
</div>
Here s the jQuery:
$("#divComment a.showCommentAttachment").click(function() {
var nextSibling = $(this).next().find( input:hidden ).val();
$("#showCommentId").html(nextSibling + "<-- Here s the comment ID ");
});
what I get back from nextSibling is undefined. I tried with nexAll like this
var nextSibling =美元(这里)。
尚未确定。
谢谢。