HTML5 form required attribute. Set custom validation message?

前端 未结 14 1653
你的背包
你的背包 2020-11-22 01:26

I\'ve got the following HTML5 form: http://jsfiddle.net/nfgfP/

14条回答
  •  盖世英雄少女心
    2020-11-22 01:35

    Okay, oninvalid works well but it shows error even if user entered valid data. So I have used below to tackle it, hope it will work for you as well,

    oninvalid="this.setCustomValidity('Your custom message.')" onkeyup="setCustomValidity('')"

提交回复
热议问题