我在一个页面上有几个对象,我想只在其中一些对象上使用 jQuery 执行操作——那些没有指定属性的对象.所以:
I have several objects on a page and I want to perform an operation using jQuery only on some of them - the ones that don't have a specified attribute. So:
<li style='...'>some text</li>
<li style='...'>some other text</li>
<li>some very diffrent text</li>
在javascript中我会:
and in javascript I would have:
$('li[style]').hide();
这将隐藏所有具有 style 属性的元素.但是如果我想隐藏那些 without 它,我的选择器应该是什么样子?
that would hide all elements with a style sttribute. But if I want to hide the ones without it, how should my selector look like?
jQuery("li:not([style])").hide();
这篇关于jQuery 选择器 - 查找没有指定属性的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
:target 为空时的 CSS 选择器CSS selector when :target empty(:target 为空时的 CSS 选择器)
CSS 直接后代 (>) 在选择性方面没有任何价值Does the CSS direct decendant (gt;) not have any value in selectivity?(CSS 直接后代 (gt;) 在选择性方面没有任何价值吗?)
使用 querySelectorAll().方法返回的结果是否有序?Using querySelectorAll(). Is the result returned by the method ordered?(使用 querySelectorAll().方法返回的结果是否有序?)
Safari 错误:当使用 JS 删除项目时,first-child 不更Safari bug :first-child doesn#39;t update display:block when items are removed with JS(Safari 错误:当使用 JS 删除项目时,first-child 不更新
nth-子 CSS 选择器nth-Child CSS selectors(nth-子 CSS 选择器)
对多个 HTML 标签使用相同的 ID?Using same ID for multiple HTML tags?(对多个 HTML 标签使用相同的 ID?)