Hi Guys, this is a post on the validation where in you will be learning how to change the default message of the form validation. The code is simple and basic, it uses the JavaScript events line 'onchange ' and 'oninvalid '.
For more validation code, click here
In the codetwo JavaScript events are used.
For more validation code, click here
HTML
<name=" form " method="post"> <h2>Form validation</h2><p ><label>Enter your Email</label> <input type="email" required oninvalid=" mostlikers 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> )
In the code
- Oninvalid event gets triggered, if the data is not entered or is invalid.
- Onchange event is triggered when the input field is changed.
NOTE:
You can run the 'onchange ' and 'oninvalid ' events in the script tag.
No comments:
Post a Comment