Skip to content
Advertisement

Jquery script not working after ajax call

I have a problem, This Jquery Script not working after I did an ajax call and replaced the old content, you can see in the scripts the “slideToggle()” Not working but other orders like add and remove class’s working well? how I can fix this?

var $content = $(".slide_content").show();  


$('body').on('click', '.arrow-slide', function () {
          
          if($('.randomclass',this).hasClass("table")){ 
            $('.randomclass',this).removeClass('meow'); <Works
            $('.randomclass',this).addClass('haow'); <Works
          }else{
            $('.randomclass',this).addClass('haow'); <Works
            $('.randomclass',this).removeClass('meow'); <Works
          }
          $content.slideToggle(); **<NOT WORKING**
});

Advertisement

Answer

    var $content = $(".slide_content").show();  
    
    
    $('body').on('click', '.arrow-slide', function () {

          var $content = $(".slide_content");
 
          if($('.randomclass',this).hasClass("table")){ 
            $('.randomclass',this).removeClass('meow'); <Works
            $('.randomclass',this).addClass('haow'); <Works
          }else{
            $('.randomclass',this).addClass('haow'); <Works
            $('.randomclass',this).removeClass('meow'); <Works
          }
          $content.slideToggle(); **<NOT WORKING**
});
Advertisement