带有 HTML 的网页如下所示:
<div id="Parent-div" > </div>
<div class="first-child-div"> </div>
<div class=" second-child-div">
<div class="first-grand-child"> </div>
<div class="second-grand-child"> </div>
<div class="Third-grand-child">
<div class="Grand-grand child">
<button class="Confirm-button">Confirm!</button>
</div>
</div>
</div>
我试过这个代码使用greasemonkey从div中删除一个名为“Grand-grand child”的类的按钮
这就是我所做的:
var targetDiv = document.querySelector("#<Parent-div>. Grand-grand.child");
targetDiv.innerHTML = "Hello world!";
Button 并没有被 Hello world 取代!文字,我做错了什么?