i’m triyng (without success) to reach and hide all nested elements with class “remove” inside a div
this is the the snippet of code that append the elements
$('<li id="com'+msg[key]['id']+'"></li>').prependTo('.mCSB_container').html('<div class="acomments"> <img src="'+url_Avatar+'" alt="Avatar fotomontaggio" /></div><div class="tcomments"><h1>'+nome+'</h1><p class="text">'+commento+'</p><p class="differenza">'+dif+'</p>**<p class="remove" id="r'+msg[key]['id']+'">rimuovi commento</p></div>');
and this is the script that tries to hide those elements
$(document).ready(function() { $('.remove').hide();});
could someone help me please? i can’t get out of this…
Supposing you have
The hiding code is running before the addition (ready comes before load). This means it hides nothing.
The solution is to ensure you execute the hiding code after the creation of elements :