I’m having some trouble executing the slideDown() function in the code below. I’m using the live() function because the html was dynamicly added.
When I console log the elem var it returns the html, so jquery did finds it but does not execute slideDown() on it. It just doesn’t slide down (also no errors and fadeIn() and show() functions don’t work either).
Does anyone know what’s the problem here? It’s really starting to annoy me
$(".werkwijze").live('click', function(event) {
var num = $(this).attr('id');
num = new String(num);
num = num.split('_');
var elem = $("#uitklap_"+num[2]);
if(elem.is(':visible')){
console.log(21);
elem.slideUp();
}else{
console.log(22);
elem.slideDown();
//$(".uitklapper").slideUp();
}
});
Your code should work fine. Try using
slideToggleit does the same thing, toggles between show/hide with sliding effect.