简体   繁体   English

如何制作window.prompt javascript中需要的字段

[英]How to make window.prompt fields required in javascript

I am taking input using window.prompt.我正在使用 window.prompt 进行输入。 There are three prompt one after another.三个提示依次出现。 I want to make every prompt box required like we do in form fields.我想让每个提示框都像我们在表单字段中那样需要。 Is there any way to achieve that facility in javascript?有没有办法在 javascript 中实现该设施?

I think you can inspire from below code for every prompt:我认为您可以从以下代码中获得每个提示的灵感:

let input = prompt('Do something?');
if (input === null || input.trim() === "") {
   // execute certain action
}

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

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