Debt Consolidation - Calendar news - Debt Consolidation - Wordpress Themes - Loans

PDA

View Full Version : How to verify if '@' is in a string?!


softgroups
Mar 10th 2008, 11:50 am
Ok


I am having an input type=text name=email


and i would like to verify if it's having the '@' sign on it.
How i can do this?!

Please help !

johngalt192
Mar 10th 2008, 12:10 pm
You can use the IndexOf function to test for '@'.

For example,

if (form.email.value.indexOf('@')>0) alert('Email contains @')

You will want to modify this to your needs based upon your field's actual name (e.g. It may not be located in a form named 'form'), and how you want to use the result of the test.