初识JQuery 实例一(first)

2019-12-24,,,

完整代码:
复制代码 代码如下:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.highlight
{
background-color: yellow;
}
.gray
{
background-color: Gray;
}
</style>
<script src="http://code.jquery.com/jquery-1.5.js"></script>
</head>
<body>
<ul>
<li>Look:</li>
<li>This is some text in a paragraph.</li>
<li>This is a note about it.</li>
</ul>
<script type="text/javascript">
$("ul li").first().addClass('highlight');
jQuery("ul li").first().next().addClass('gray');
</script>
</body>
</html>

您可能感兴趣的文章:

  • 浅谈jQuery中对象遍历.eq().first().last().slice()方法
  • jQuery中:first选择器用法实例
  • Jquery 过滤器(first,last,not,even,odd)的使用
  • jQuery中eq()方法用法实例
  • jQuery中toggleClass()方法用法实例
  • jQuery中removeClass()方法用法实例
  • jQuery中addClass()方法用法实例
  • jQuery中removeProp()方法用法实例
  • jQuery中prop()方法用法实例
  • jQuery中first()方法用法实例

《初识JQuery 实例一(first).doc》

下载本文的Word格式文档,以方便收藏与打印。