简体   繁体   English

jQuery中没有“确定”按钮的警报框

[英]alert box without ok button in jQuery

How to show alert box without "OK" button and close after 2 seconds 如何显示没有“确定”按钮的警报框并在2秒后关闭

setTimeout(function() { 
  alert("$premium$");
}, 1);

It's not possible to amend the dialog shown by the standard alert() method as the buttons are controlled by the browser/OS. 由于按钮是由浏览器/操作系统控制的,因此无法修改标准alert()方法显示的对话框。

If you need this behaviour you'll need to use a library which builds alert notifications in HTML which can be amended exactly as you require. 如果您需要这种行为,则需要使用一个库,该库以HTML格式构建警报通知,可以根据需要进行完全修改。

您应该在香草CSS中创建自己的警报框

You cannot hide buttons from native JavaScript dialogs. 您无法从本机JavaScript对话框中隐藏按钮。 Your options depends on frameworks you are using. 您的选择取决于您使用的框架。 You can create custom dialogs with jQuery UI , Bootstrap and many other frameworks. 您可以使用jQuery UIBootstrap和许多其他框架来创建自定义对话框。

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

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