fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> <script src="https://apps.bdimg.com/libs/jquery/2.1.4/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>第一个段落</p> <p>最后一个段落</p> </div><br> <div style="border:1px solid;"> <p>只有一个段落</p> </div><br> <div style="border:1px solid;"> <span>这是 span 元素</span> <p>唯一的段落</p> </div><br> </body> </html>
运行结果