jQuery分组选择器 jQuery分组选择器简单用法示例

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

jQuery分组选择器 jQuery分组选择器简单用法示例

恋恋玫瑰花   2021-03-30 我要评论

本文实例讲述了jQuery分组选择器简单用法。分享给大家供大家参考,具体如下:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>jQuery分组选择器</title>
  <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
  <script type="text/javascript">
    $(function(){
      // 注意:#content.title,.header.title无效
      $('.header, div.title, [title="foot"]').css('backgroundColor','red');
    });
  </script>
</head>
<body>
  <div class="header">header
    <div class="title">title</div>
  </div>
  <hr>
  <div id="content">
    content
    <div class="title">title</div>
    <div class="context">context</div>
    <div class="other">other</div>
  </div>
  <hr>
  <footer title='foot'>footer</footer>
</body>
</html>

这里使用在线HTML/CSS/JavaScript代码运行工具http://tools.softyun.net/code/HtmlJsRun测试上述代码,可得如下运行效果:

希望本文所述对大家jQuery程序设计有所帮助。

猜您喜欢

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们