[英]Select all the elements within an element having an attribute set to a specific value
我定义了以下内容:
var excludedFiltersPanel = $("#excludedFiltersPanel");
var includedfiltersPanel = $("#includedfiltersPanel");
* Panel只是一个div。
在excludedFiltersPanel
有一些DIV与属性data-iscorefilter="true"
如:
<div id="filterPanel-LastName" class="filterPanel" data-iscorefilter="true">
<Some Stuff here!>
</div>
我正在尝试获取它们并将它们移到includedfiltersPanel中:
似乎这些都不是正确的语法:
excludedFiltersPanel.('[data-iscorefilter="true"]')
excludedFiltersPanel.$('[data-iscorefilter="true"]')
1.正确的语法是什么?
2.如何将它们附加到includedfiltersPanel
? (我知道如何附加单个项目,但不确定此处常见的良好做法是什么,例如,使用for循环或某些JQuery魔术)
由于excludedFiltersPanel there are some div's with attribute data-iscorefilter="true"
使用.find()
描述:获取当前匹配元素集中每个元素的后代,并通过选择器,jQuery对象或元素进行过滤。
它看起来像:
excludedFiltersPanel.find('[data-iscorefilter="true"]')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.