I’m working on a small project and I’ve ran in to a problem.
I’m using jQuery to create new elements. So because they were not in the document when the page loaded, I can’t manipulate them in any way.
Is there a way to make jQuery read the new elements in order to fix my problem?
$("img.fbimg").click(function(){
$(this).hide();
});
You need to use event delegation:
Here you may replace
"body"with any static parent element ofimg.fbimg.