Hide with callback function
Description
The following code shows how to hide with callback function.
Example
<html>
<head>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {<!-- w w w . j av a 2s . co m-->
$("#hideHandler").click(function() {
$("span:first-child").hide("fast", function() {
$(this).prev().hide("show", arguments.callee);
});
});
$("#showHandler").click(function() {
$("span").show(6000);
});
});
</script>
</head>
<body>
<button id="hideHandler">Hide</button>
<button id="showHandler">Show</button>
<div>
<span>A</span> <span>B</span> <span>C</span> <span>D</span> <span>E</span>
<span>F</span> <span>G</span> <span>H</span>
</div>
</body>
</html>