1

I want to validate email address on text field i.e. <input type='text'/> fields. I know in html5 there is a separate field for email i.e <input type='email'/>. But due to some reasons I can't / don't want to use that tag. Also in HTML 5 there there is default validation messages. But I am using some thing like below to show custom validation messages:

oninvalid='this.setCustomValidity("please enter your first name")' oninput='setCustomValidity("")'

this code is working fine for my required text fields. I want to validate my email address in same way with custom messages like: you have not included @ sign or you have not included domain name etc. How can I do this with similar pattern for showing email validation with custom HTML 5 messages.

JPG
  • 1,247
  • 5
  • 31
  • 64
  • Possible duplicate of http://stackoverflow.com/questions/13798313/set-custom-html5-required-field-validation-message – Teoman shipahi Oct 26 '15 at 13:51
  • 3
    Possible duplicate of [Validate email address textbox using JavaScript](http://stackoverflow.com/questions/7635533/validate-email-address-textbox-using-javascript) – ceejayoz Oct 26 '15 at 14:01
  • @ceejayoz there they are using alert box to show it is invalidate. I want HTML 5 validation messages that comes near the field like a tool tip. – JPG Oct 26 '15 at 14:11
  • @Teomanshipahi from the link you have mentioned, from there only I have added oninvalidate and oninput event attributes on my text field. – JPG Oct 26 '15 at 14:13

0 Answers0