How can I programmatically mark text field as invalid?

安稳与你 提交于 2019-12-11 07:39:16

问题


How can I programmatically mark text field as invalid in Material Design Light?

My HTML code:

  <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
    <input id="email" type="email" class="mdl-textfield__input">
    <label for="email" class="mdl-textfield__label">Email</label>
    <span class="mdl-textfield__error">Email is invalid or already taken!!!</span>
  </div>

I added is-invalid class in JavaScript but it displays badly:

来源:https://stackoverflow.com/questions/44528717/how-can-i-programmatically-mark-text-field-as-invalid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!