setCustomValidity doesn't immediately trigger validation, you have to have a form submit event to trigger it or call checkValidity . I've updated your CodePen ...
確定! 回上一頁