close
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<style type="text/css">
.red{
color: red;
}
</style>
</head>
<body>
<ul>
<li>1</li>
<li>2</li>
<li id="three">3</li>
<li>4</li>
<li>5</li>
</ul>
<script type="text/javascript">
$(function(){
$('li[id!="three"]').addClass('red');
});
</script>
</body>
</html>
全站熱搜
留言列表