标签:cti rip pre body script style first css doctype
first()
概述
获取匹配的第一个元素
last()
概述
获取匹配的最后个元素
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script type="text/javascript" src="js/jquery-3.1.1.min.js" ></script> <title></title> <script> $(document).ready(function(){ //first()获取匹配的第一个元素 $("li").first().css({"color":"#FF0000","font-weight":"bold"}); //last()获取匹配的最后一个元素 $("li").last().css({"color":"#FF0000","font-weight":"bold"}); }); </script> </head> <body> <ol> <li>Java</li> <li>JavaScript</li> <li>C#</li> <li>CSS</li> <li>HTML</li> </ol> </body> </html>
标签:cti rip pre body script style first css doctype
原文地址:https://www.cnblogs.com/xianya/p/9957758.html