使用jQuery/Underscore,给定以下列表。我如何才能找到那些不属于李W内data-allow-html="true"
如何找到不在数据属性中的所有元素
<ol>
<li><div class="msg">message</div></li>
<li data-allow-html="true"><div class="msg">message</div></li>
<li><div class="msg">message</div></li>
<li data-allow-html="true"><div class="msg">message</div></li>
<li><div class="msg">message</div></li>
<li data-allow-html="true"><div class="msg">message</div></li>
<li><div class="msg">message</div></li>
<li data-allow-html="true"><div class="msg">message</div></li>
</ol>
所有.msg
元素我目前有:
$('#mydiv').find('.msg').each(function() {}
,并尝试:
$('#mydiv').find('li').not('data-allow-html="true"').find('.msg').each(function() {}
似乎这不工作。想法?由于
http://stackoverflow.com/questions/2891452/jquery-data-selector –