<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Title</title>
<style >
.hide{
display:none
}
</style>
</head>
<body>
<input id=22 type="button" value="开关"/>
<div class="a hide">fffff</div>
<script src="jquery-1.12.4.js"></script>
<script>
// 点击按钮如果有hide 就移除,如果没有就加上hide
// $('#22').click(function () {
// if ($('.a').hasClass('hide')){
// $('.a').removeClass('hide')
// }else
// $('.a').addClass('hide')
// })
$("#22").click(function () {
$('.a').toggleClass('hide')
})
//toggleClass有的话我你去的,没有的加上
</script>
</body>
</html>