< input name= "" type= "text" required / >
< input name= "" type= "text" required / >
required only requires the user to fill in.
has nothing to do with whether the check is successful or not.
in addition, if you want to get the result of require=true
, your input can write
required dom getAttribute()
API
input.validity
input.validity.valid
input.validity.badInput
input.validationMessage
input.setCustomValidity
input.formNoValidate
input.willValidate
input.addEventListener('invalid' , function () {
input.setCustomValidity('')
console.log(input.validationMessage)
})
Previous: Python cannot write variables to txt
Next: How to make the points in the mouse-drawn area of the map appear at the top