jQuery分组选择器简单用法示例
时间:2021-10-02 07:27:03|栏目:jquery|点击: 次
本文实例讲述了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.jb51.net/code/HtmlJsRun测试上述代码,可得如下运行效果:

更多关于jQuery相关内容感兴趣的读者可查看本站专题:《jQuery页面元素操作技巧汇总》、《jQuery常见事件用法与技巧总结》、《jQuery常用插件及用法总结》、《jQuery扩展技巧总结》及《jquery选择器用法总结》
希望本文所述对大家jQuery程序设计有所帮助。
上一篇:jquery 学习笔记一
栏 目:jquery
下一篇:xheditor与validate插件冲突的解决方案
本文标题:jQuery分组选择器简单用法示例
本文地址:http://www.codeinn.net/misctech/178471.html






