This post make on custom to change the HTML 5 Form validation error message. previously Error message Display on default so now you change custom message on input validation field.
HTML
<form name="mostlikers" method="post">
<h2>Form validation</h2>
<p><label>Enter your Email</label>
<input type="email" required oninvalid="setCustomValidity('Plz Enter check your Email id ')"
placeholder="ex:jo@gm.com" onchange="try{setCustomValidity('')}catch(e){}" /></p>
<input type="submit" value="Check Email"/>
</form>
Just Enter your custom message in oninvalid="setCustomValidity('Plz Enter check your Email id ')" oninvalid
function otherwise validation not working just add this onchange function onchange="try{setCustomValidity('')}catch(e){}"
HTML
<form name="mostlikers" method="post">
<h2>Form validation</h2>
<p><label>Enter your Email</label>
<input type="email" required oninvalid="setCustomValidity('Plz Enter check your Email id ')"
placeholder="ex:jo@gm.com" onchange="try{setCustomValidity('')}catch(e){}" /></p>
<input type="submit" value="Check Email"/>
</form>
Just Enter your custom message in oninvalid="setCustomValidity('Plz Enter check your Email id ')" oninvalid
function otherwise validation not working just add this onchange function onchange="try{setCustomValidity('')}catch(e){}"
0 comments:
Post a Comment