运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p:only-of-type").css("background-color", "yellow"); }); </script> </head> <body> <div style="border:1px solid;"> <p>The first paragraph.</p> <p>The last paragraph.</p> </div><br> <div style="border:1px solid;"> <p>The only paragraph.</p> </div><br> <div style="border:1px solid;"> <span>This is a span element.</span> <p>The only paragraph.</p> </div><br> </body> </html>