<html lang="zh-cn">
<head>
<meta http-equiv="content-type" content="text/htmlcharset=utf-8" />
<title>Document</title>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<style type="text/css">
.className { background-color: #333}
</style>
</head>
<body>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<th scope="col">a</th>
<th scope="col">b</th>
<th scope="col">c </th>
<th scope="col">d </th>
</tr>
<tr><td colspan="4">e</td></tr>
<tr>
<td colspan="2">f</td>
<td colspan="2">g</td>
</tr>
<tr> <td colspan="4">h</td> </tr>
<tr>
<td>j</td>
<td>k</td>
<td>l</td>
<td>m</td>
</tr>
</table>
<script type="text/javascript">
$("td[colspan='4']").each(function(){
$(this).addClass('className')
})
//所有th
$('th').each(function(){
$(this).addClass('className')
})
</script>
</body>
</html>
//css 是不是没写啊
$(function(){$(document).on("click",".nav-item>a",function(){
$(this).addClass("active").parent(".nav-item").siblings(".nav-item").children("a").removeClass("active")
})
})
如果好使,请给个采纳
$(function(){//alert(1)
$('.m_l dl dt').mouseover(
function(){
//alert(1)
$('.m_l dl dt').removeClass("m_1_class2")//清除class
$(this).addClass("m_1_class2")//添加class
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)