如何使用HTML 5属性仅对提交或用户输入进行验证?

时间:2016-05-29 13:53:06

标签: html html5 forms material-design-lite

我只想在用户与字段交互或提交表单时验证字段。

以下是我正在使用的代码:

 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
    <input class="mdl-textfield__input" type="text" name="titleOfTheEmailField" id="titleOfTheEmailField" onchange="updateTitle()" required>
    <label class="mdl-textfield__label" for="sample3">Title...</label>
</div>

这是输出:

enter image description here

但是我只想在用户与字段交互或提交表单后才想要输出。

这不是How to force a html5 form validation without submitting it via jQuery的重复,而是与该问题完全相反。

P.S:我正在将Material Design Lite用于我的网络应用程序。

0 个答案:

没有答案
相关问题