html5 oninvalid doesn't work after fixed the input field

前端 未结 5 1635
故里飘歌
故里飘歌 2020-12-06 01:08

I have this input code in my form:



        
5条回答
  •  情话喂你
    2020-12-06 01:58

    If you set a value with setCustomValidity() then the field is invalid. That is setting a non-zero length string causes the browser to consider the field invalid. In order to take effects of your new input you have to clear the custom validity. Simply you can use the following:

    
    

    There is no need to use Javascript for this.

提交回复
热议问题