How can I create a custom message when an HTML5 required input pattern does not pass?

前端 未结 8 688
伪装坚强ぢ
伪装坚强ぢ 2021-02-01 04:08

I have the following:



        
8条回答
  •  时光说笑
    2021-02-01 04:38

    It is very simple without javascript or jQuery validation. We can achieve it by HTML5

    Let suppose we have HTML field:

    
    

    Just change the HTML as

    
    

    If you observe, just add title = "Error message"

    Now whenever form will be post, the given messages will be appeared and we did not need JavaScript or jQuery check. This solution works for me.

提交回复
热议问题