How to select an element loaded through the jQuery load() function?

The load function is asynchronous.
Your next line runs before the content is loaded.

You need to put your code inside the load function’s callback, so that it will only run after the new content is loaded:

$('#container').load('content.html', function() {
    $('.elementInContentHTML').fadeIn();
});

Leave a Comment