abstract:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">&
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>选择效果</title>
<style>
li {
width: 100px;
height: 50px;
border: 1px salmon solid;
margin: 50px 30px 0px 0px;
padding: 0;
text-align: center;
line-height: 50px;
float: left;
list-style: none;
}
.active {
background: salmon;
}
</style>
</head>
<body>
<ul>
<li>1</li>
<li>1</li>
<li>1</li>
<li>1</li>
</ul>
</body>
<script src="./js/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
$(function() {
$('li').click(function(){
if($(this).hasClass('active')){
$(this).removeClass('active')
}else{
$(this).addClass('active').siblings('li').removeClass('active')
}
})
})
</script>
</html>
Correcting teacher:天蓬老师Correction time:2019-08-07 13:27:47
Teacher's summary:代码并不完整, 应该是没有写完, 下回写完再提交