我想在当前类.news
中设置类.cha的显示 $(function () {
$('.cha').click(function(){
$(this).parent().find('.change').css('display','inline');
});
});
答案 0 :(得分:-1)
jQuery(document).ready(function($){
$('.button').click(function(){
$('ul li:nth-child(3)').addClass('red');
});
});
.red{
background:red;
}
<!DOCTYPE html>
<html lang="">
<head>
<link rel="stylesheet" href="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/css/bootstrap.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
<li>item4</li>
</ul>
<a href="#" class="button">Select</a>
<!-- jQuery -->
</body>
</html>