Demo JQuery .next() .prev()

by Taufik Nurrohman

HTML

<div></div>
<button>Klik</button>
<div></div>

CSS

body {text-align:center;}

div {
  background-color:#123456;
  width:200px;
  height:120px;
  margin:10px auto;    
}

JavaScript

$('button').click(function() {
   $(this).prev().fadeToggle('slow');
   $(this).next().slideToggle('slow');
});