[英]Javascript / Select elements without a Class
I've got a Calendar-table (created as a Javascript Object). 我有一个日历表(创建为Javascript对象)。 Its top row involves both the days of previous and current month.
它的第一行涉及上个月和当前月份。 I marked the days of the current month with Class "Out".
我将“ Out”类标记为当月的日子。 Now I need to select the days of the previous month in order to make a Statement if {The top table row has the cells without Class "Out", I don't want to show them } How can I do that using native Javascript?
现在, 如果{{最上面的表格行中的单元格没有“ Out”类,我不想显示它们 ) ,我就需要选择上个月的日子。如何使用本机Javascript做到这一点? In other words it seems like I need an analogue of .not() in JQuery.
换句话说,似乎我在JQuery中需要一个.not()的类似物。
:not(simple-selector)
is actually a valid selector that you can pass to querySelector
(and it is pretty well supported too . :not(simple-selector)
实际上是一个有效的选择器,您可以将其传递给querySelector
(它也得到了很好的支持 。
if (!document.querySelector(".your-table tr:first-child td:not(.Out)") {
// Then we need to hide that row
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.