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>
</head>
<body>
<h2>title</h2>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
小於<input id="input">會被刪掉
<button id="btn">按我</button>
<script type="text/javascript">
$('#btn').on('click',function(){
var input=$('#input').val()-1;
$('li:lt('+input+')').fadeOut(800).queue(function(){
$(this).remove();
})
});
</script>
</body>
</html>
全站熱搜
留言列表