<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript" src="jquery-1.10.2.js"> </script>
<script type="text/javascript">
$(function(){
$(".className2").css("background","red");
});
</script>
</head>
<body>
<div style="height:500px;width:500px">
<div class="className1 className2" style="height:100px;width:100px;">
</div>
<div class="className2" style="height:100px;width:100px;background:green">
</div>
</div>
</body>
</html>
效果图如下:
jQuery 选择器获取组合类中的类名
时间: 2024-10-01 04:56:08