这是我的html:
<ul class="inboxList">
<li data-selecttype='global|mailbox|inbox'>Inbox</li>
</ul>
这是我的jQuery代码:
$(".inboxList").children().each(function(child){
console.log($(child).data("selecttype"));
});
我还尝试取出孩子的 $() :
$(".inboxList").children().each(function(child){
console.log(child.data("selecttype"));
});
但这没有用。
我的返回值为空且未定义。我期望返回值global|mailbox|inbox
是我做错了什么?
感谢您的帮助!