Search code examples
jqueryslidedownslideup

If elem SlideDown .. then slideUp jquery


i have this jquery code

$(document).ready(function(){
  $(".C_bmiShowTableWord").click(function () {
    $(".C_bmiShowTable").slideDown();
  });
});

if i click the C_bmiShowTableWord it will slide down C_bmiShowTable

i want to make it if i click the C_bmiShowTableWord and C_bmiShowTable already been slide down , then slide it up .. and vice ^_^


Solution

  • $(document).ready(function(){
      $(".C_bmiShowTableWord").click(function () {
        $(".C_bmiShowTable").slideToggle();
      });
    });
    

    Just use slideToggle instead.