In a page i create and remove #container dynamically using append and remove.
I found an issue trying to remove #container that was dynamically added, in result of an ajax get().
function ajaxNavigation(link) { $.get(''+link,function(data) { if(data!='KO'){ $('#container').remove(); $('#column_left').append('<section id="container">'+data+'</section>'); } }); }
and later in the page
$('document').on("click","#button",function(){ ajaxNavigation('link.php'); });
The issue is: remove() dosen't work, that's becouse #cointainer is dynamically added.
Usually i use on(), to add a listener, but i don't know how to use it in the get() success function.