jQuery :first :last选择器
2017-01-05 17:10
351 查看
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>:first</title> </head> <script src="jquery-1.11.3.min.js"> </script> <body> <!-- :first获取匹配到的第一个元素 --> <ul> <li>list item 1</li> <li>list item 2</li> <li>list item 3</li> <li>list item 4</li> <li>list item 5</li> </ul> </body> <script type="text/javascript"> //$('ul:first').css('background','orange'); $('li:first').css('background','orange'); $('li:last').css('background','yellow'); </script> </html>
效果图:
相关文章推荐
- jQuery中 :first 和 :last 选择器诡异问题
- jquery 的:first-child 和:last-child 选择器实例
- jquery基本过滤选择器:first :last :not(.myclass) :even :odd :eq(1) :gt(5) :lt(1) :header :animated :focus
- jQuery选择器中last-of-type和first-of-type效果案例
- 【JQuery】:first和:last过滤选择器
- jQuery选择器中last-of-type和first-of-type效果案例
- 知识点七:jQuery 遍历 - 过滤first(), last() 和 eq(),filter() 和 not()
- 理解Jquery的first-of-type选择器
- jQuery :first选择器使用介绍
- jQuery :first选择器使用介绍
- jQuery中 :first选择器,first()和:first-child选择器的区别
- CSS nth-child、first-child、last-child、nth-of-type、first-of-type和last-of-type选择器使用
- jQuery 选择器 first-child和first-of-type、 last-child和last-of-type的区别
- 【阅读】《Head First jQuery》第二章——选择器与方法(一个点击图片页面显示文字的小例子)
- Jquery 选择器(:last-child)详解
- jQuery - Selectors选择器 - first第一个元素
- jQuery中first-child与first选择器区别
- 浅谈jQuery中对象遍历.eq().first().last().slice()方法
- jQuery原型方法first,last,eq,slice源码分析
- jQuery中:last选择器用法实例