我的代码为html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>What webbing will you buy next ?</title>
<script src="main.js"></script>
<link rel="stylesheet" href="main.css">
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
</head>
<body>
<h1>WHAT WEBBING WILL I BUY NEXT ?</h1>
<div class="container">
<div class="row">
<div class="col s12">
<a class="waves-effect waves-light btn-large">Button</a>
</div>
</div>
<div class="row">
<div class="col s2 webbing polyamid">
Polyamid
</div>
<div class="col s2 webbing polyester">
Polyester
</div>
<div class="col s2 webbing nylon">
Nylon
</div>
<div class="col s2 webbing tubular">
Tubular
</div>
<div class="col s2 webbing heavy">
Heavy
</div>
<div class="col s2 webbing light">
Light
</div>
</div>
</div>
</body>
</html>
我试图选择我行内的每个div都没有某个类(例如聚酯),但无法弄清楚如何。
我试过这个:
var nopoly = document.querySelectorAll(".webbing:not(.polyester)");
console.log(nopoly);
但控制台只显示一个长度等于0的节点列表,无法理解为什么。
纯粹的javascript,任何人都可以帮助我吗?谢谢:))