SO Question 25953656

by TexasBrawler

HTML

<div id="the_div">This is my div.</div>
<button id="button1">Click to hide the div.</button>

<div id="second_div">This is another div.</div>
<button id="button2">Click to hide the second div immediately.</button>

JavaScript

$('#button1').on('click',
               function () {
                   $('#the_div').hide(
                       {done: function() { alert("Hiding complete!"); } }
                       );
               }
               );

$('#button2').on('click',
               function () {
                   $('#second_div').hide(
                       {
                           done: function() { alert("Hiding complete!"); },
                           duration: 0
                       }
                       );
               }
               );