我有一些div
基于其功能的集合,从中class(es)
,我只是试图data attribute
从. 所以,我决定这将适合我的要求。但不幸的是它正在回归。谁能告诉我我的片段有什么问题。first div
last div
closest
null
HTML:
<div class="DivApplication">
<div class="DivImg DivImgRun DivImgLeft" data-internalid=16></div>
<div class="DivAppName">Application Title</div>
<div class="DivTime">Created: 23-06-2013 | Edited: 23 July 2013 </div>
<div class="DivImg DivImgReport DivImgRight">report</div>
<div class="DivImg DivImgDelete DivImgRight">delete</div>
<div class="DivImg DivImgEdit DivImgRight">edit</div>
</div>
查询:
$(document).ready(function(){
$(".DivImgEdit").click(function(){
alert($(this).closest('.DivImgRun').data('internalid'));
});
});
结果: NULL