简体   繁体   English

单击警报确定后执行某些操作

[英]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! 尝试运行自己的代码,或者这个JS Fiddle ,看看它的实际运行情况!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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