'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**
});
Solution 1:[1]
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**
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | kovrita is The life |
