运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到空间
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("div:not(:has(h1))").css("background-color", "yellow"); }); </script> </head> <body> <div> <h1>This is a heading (h1)</h1> <p>This is a paragraph.</p> </div> <div> <h2>This is a heading (h2)</h2> <p>This is a paragraph.</p> </div> <div> <h3>This is a heading (h3)</h3> <p>This is a paragraph.</p> </div> </body> </html>