1 回答

TA貢獻(xiàn)1860條經(jīng)驗(yàn) 獲得超9個(gè)贊
您沒(méi)有清除您的setCustomValidity()。如果您使用 setCustomValidity() 設(shè)置值,則該字段無(wú)效。只需將此類(lèi)屬性添加到您的輸入標(biāo)記即可:
oninput="setCustomValidity('')"
已在您的代碼中修復(fù):
<form class="user" action="code_user.php" method="POST">
<div class="form-group">
<label>Enter Full Name</label>
<input class="form-control" pattern="^[a-zA-Z]+(( )+[a-zA-z]+)*$" oninvalid="setCustomValidity('Please enter in alphabets only. ')" oninput="setCustomValidity('')" type="text" name="name" autocomplete="off" required />
</div>
<button type="submit" id="submit"name="signup_btn"class="btn btn-primary btn-user btn-block"> Sign Up </button>
</form>
- 1 回答
- 0 關(guān)注
- 172 瀏覽
添加回答
舉報(bào)