jQuery中last()方法用法实例
2018-10-12 14:01
621 查看
本文实例讲述了jQuery中last()方法用法。分享给大家供大家参考。具体分析如下:
此方法获取匹配元素集合中的最后一个元素。
语法:
$(selector).last()
实例:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<title>脚本之家</title>
<script type="text/javascript" src="js/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("li").last().css("color","blue")
})
</script>
</head>
<body>
<div>
<ul>
<li>HTML专区</li>
<li class="js">Javascript专区</li>
<li>Div+Css专区</li>
<li>Jquery专区</li>
</ul>
</div>
</body>
</html>
希望本文所述对大家的jQuery程序设计有所帮助。
您可能感兴趣的文章:
相关文章推荐
- jQuery中last()方法用法实例
- jQuery中replaceAll()方法用法实例
- jQuery中attr()方法用法实例
- jQuery中live()方法用法实例
- jQuery中parentsUntil()方法用法实例
- jQuery中ajax的get()方法用法实例
- jQuery中end()方法用法实例
- jQuery中innerHeight()方法用法实例
- jQuery中prev()方法用法实例
- jQuery中filter()方法用法实例
- jQuery使用hide方法隐藏指定元素class样式用法实例
- jQuery中bind()方法用法实例
- jQuery中wrapInner()方法用法实例
- jQuery中unbind()方法用法实例
- jQuery中fadeOut()方法用法实例
- jQuery中contents()方法用法实例
- jQuery中after()方法用法实例