简体   繁体   中英

Run function when another function finishes jQuery

When a page is done refreshing, jQuery event is launched:

$(#id).trigger('reloaded');

'reloaded' is a custom event;

How do i set up a listener , such that, when it is done 'reloading' , i run another function:

I was thinking about this:

$(#id).on('reloaded',function(ev) {
    alert("LAUNCH function");
});

But this doesnt work

You are missing a quote in your alert()

it should look like this:

$('#id').on('reloaded',function(ev){
            alert("LAUNCH function");

            });

EDIT: quotes in the selector thanks to @Pinocchio

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM