<!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>removeClass()</title>
<style type="text/css">
.red{ color:#F00}
.height{ font-size:24px}
</style>
<script type="text/javascript" src="jquery-1.8.1.js"></script>
<script type="text/javascript">
$(function(){
/*$('input').click(function(){
$('div').removeClass('height')
})*/
//如果用removeClass( )括号内为空,表示清除所有的class
$('input').click(function(){
$('div').removeClass()
})
})
</script>
</head>
<body>
<div class="height red">这是一个div</div>
<input type="button" value="ceshi"/>
</body>
</html>
联系客服