How to call a function after a fadeOut() on many elements

You can use the promise() method for this (the doc page has a good example for this).

The .promise() method returns a dynamically generated Promise that is resolved once all actions of a certain type bound to the collection, queued or not, have ended.

Applied to your example should be something like this:

$.when(
    $('.hotel_photo_select').fadeOut(500)
).done(function() {

    alert("Now all '.hotel_photo_select are hidden'");

});

OR

$('.hotel_photo_select').fadeOut(500)
    .promise().done(function() {
        alert('Got this far!');
    });

$(element).fadeOut(duration, onComplete)

Example:

$('#box').fadeOut(400, () => { console.log('Fade effect is done') })

Tags:

Jquery