如何以html类型的形式设置条件?

问题描述 投票:0回答:1

我如何设置一个条件,要求日期为dd / mm / yyyy和性别(男/女或其他)?我为其他输入类型的样式创建了此输入类型,但我想设置条件来验证此字段。

<div class="input-container input9">
    <input type="#{type}" id="#{label}" required="required"/>
    <label for="#{label}">gender</label>
    <div class="bar"></div>
</div>
<div class="input-container input10">
    <input type="#{type}" id="#{label}" required="required"/>
    <label for="#{label}">date of birth</label>
    <div class="bar"></div>
</div>
html web
1个回答
0
投票

您没有指定要使用的JS库或CSS。所以使用纯HTML可以做到这样的事情:

 <div class="input-container input9">
  <!-- <input type="#{type}" id="#{label}" required="required"/> -->
  <select>
    <option value='male'>male</option>
    <option value='female'>female</option>
    <option value='other'>other</option>
  </select>
  <label for="#{label}">gender</label>
  <div class="bar"></div>
 </div>
 <div class="input-container input10">
    <!-- <input type="#{type}" id="#{label}" required="required"/> -->
    <input type="date" name="bday" max="1979-12-31">
    <label for="#{label}">date of birth</label>
    <div class="bar"></div>
 </div>

您可以从以下网站了解更多信息:herehere

祝好运

© www.soinside.com 2019 - 2024. All rights reserved.