parents('div.content'), DIV, ol with li.
$('body').on('click', '.remove',function () {
$(this)
.parents('div.content')
.find('ol > li:gt(0)')
.slideUp(400,function(){
$(this).remove();
})
});
$(document).ready(function () {
$(".moree").click(function () {
var delay = 0;
for (var i = 0; i < 5; i++) {
$(this)
.prev()
.append('<li style="display:none">Title 2</li>')
.children()
.last()
.hide()
.delay(delay)
.slideDown(400);
delay += 400;
}
});
$('body').on('click', '.remove',function () {
$(this)
.parents('div.content')
.find('ol > li:gt(0)')
.slideUp(400,function(){
$(this).remove();
})
});
});
ol > li{ list-style:none; padding-top:10px; border:1px solid green;margin-top:10px;}
.moree{ width:30px; background:yellow;}.remove{ width:30px; background:red;}
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js">
</script>
</head>
<body>
<div class="content">
<ol>
<li>title</li>
</ol>
<div class="moree">Add 5</div>
<div class="remove">Remove 5</div>
</div>
</body>
</html>
Hide result