简体   繁体   English

必需不适用于HTML5中的输入数组

[英]Required is not working on array of input in HTML5

I want to make several text fields required with attribute required , but it is not working. 我想用属性required制作几个文本字段required ,但是它不起作用。

Any idea why? 知道为什么吗? Is it mandatory to do it with JQuery or is there any HTML5 way to do it? 使用JQuery强制执行此操作吗?是否有HTML5方式可以执行此操作?

<form method="POST" action="https://my.kendozone.com/tournaments/testlt/users" accept-charset="UTF-8" class="form-horizontal" novalidate="novalidate">

<input type="text" name="firstnames[]" class="form-control" required>
<input type="text" name="firstnames[]" class="form-control" required>
<button type="submit" class="btn btn-primary">Save</button>  
        </form>

Here is the fiddle https://jsfiddle.net/xoco70/ezt61gw6/2/ 这是小提琴https://jsfiddle.net/xoco70/ezt61gw6/2/

Try this HTML5 Markup 试试这个HTML5 标记

 <input type="text" name="firstnames[]" class="form-control" required>
 <input type="text" name="firstnames[]" class="form-control" required>

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

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