我有以下div:
<div id="icon2323" data-id="2343434" style="color: #0076c0;" data-toggle="collapse" data-target=".detail" class="fa fa-chevron-down"></div>
在我的查询代码中,我具有以下内容:
$('div[id^="icon"]').on('click',function (e) {
alert('here');
// var dataId = $(e).data("id"); did not work
});
我尝试过:
var dataId = $(e).data("id"); and tried to display the value but showed undefined.
我的问题是在这种情况下如何获取data-id的值。