简体   繁体   English

如何使用JS手动弹出所需的文本字段警报?

[英]How to manually popup required textfield alert with JS?

Do anyone know how to trigger this popup using JS? 有谁知道如何使用JS触发此弹出窗口?

例

I know by default it triggered by clicking submit type button when the text field is inside area. 我知道默认情况下,当文本字段位于区域内时,通过单击“提交类型”按钮触发。

I have my own Boostrap modal alert popup when I click submit button without filling up required text field. 当我单击提交按钮而不填写必填文本字段时,我有自己的Boostrap模态警报弹出窗口。 So once the modal alert is being dismissed, I want that default JS alert trigger after that. 因此,一旦消除了模式警报,我希望在此之后使用默认的JS警报触发器。

What you're asking about is HTML5 Constraint Validation. 您要问的是HTML5约束验证。

https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation https://developer.mozilla.org/zh-CN/docs/Web/Guide/HTML/HTML5/Constraint_validation

For your specific example, you can use the required attribute. 对于您的特定示例,您可以使用required属性。

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

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