绿草如茵的草原上还有一条细细的河,袒露在阳光下,远远看去,像一条发光的银项链。
本文实例讲述了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.haodaima.com/code/HtmlJsRun测试上述代码,可得如下运行效果:
希望本文所述对大家jQuery程序设计有所帮助。
到此这篇关于jQuery分组选择器简单用法示例就介绍到这了。一个能从别人的观念来看事情,能了解别人心灵活动的人,永远不必为自己的前途担心。更多相关jQuery分组选择器简单用法示例内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!




