I don’t understand why the fadeOut works but the remove doesn’t. I found out it’s a problem with the array. I tried some combinations, but I can’t make it work.
for (var i=0;i<fieldsblock.length;i++){
$("#"+fieldsblock[i]+"_tr"+nid).fadeOut();
t=setTimeout(function(){$("#"+fieldsblock[i]+"_tr"+nid).remove();},400);
}
Thanks.
It looks like you just need the
removeto run once thefadeOuthas completed. If that’s the case, you don’t need to usesetTimeout. You can use a callback instead:The callback is executed whenever the animation is complete, so doing it this way means you won’t have to change the
setTimeoutduration if you wanted to change the duration of the fade as well.