您的位置:首页 > Web前端 > JQuery

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

2019-04-11 09:16 796 查看

本文实例讲述了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程序设计有所帮助。

您可能感兴趣的文章:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: