changing the language of error message in required field in html5 contact form

后端 未结 9 952

I am trying to change the language of the error message in the html5 form field.

I have this code:



        
9条回答
  •  伪装坚强ぢ
    2020-11-27 13:31

    I know this is an old post but i want to share my experience.

    HTML:

    
    

    Javascript (jQuery):

    $('input[required]').on('invalid', function() {
        this.setCustomValidity($(this).data("required-message"));
    });
    

    This is a very simple sample. I hope this can help to anyone.

提交回复
热议问题