Why does the verification pass or fail? the value of required is undefind, so I can't judge whether the verification is successful or not.

< input name= "" type= "text" required / >

Mar.10,2021

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

like this.

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)
})
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e32034-4416f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e32034-4416f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?