简体   繁体   中英

Do something after clicking alert ok

How can I do something like this?

alert('Im gonna get you!');
$('#some-id').css({"display": "none"});

OR

alert('Im gonna get you!');
$('#some-id').trigger('click');

I thought anything that's called after alert() will be executed after clicking ok?

Please advice. Thank you.

I'm not sure what you're looking at. But it seems to me that the alert function is blocking, execution doesn't continue until the user clicks ok. Try running your own code, or this JS Fiddle and see it in action!

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