hankknight
asked on
Validate email address with jquery
I used the following code to give alerts for require form fields based on a class name in the input. How can I also give an alert for fields if the email address in invalid?
<html>
<script src="http://code.jquery.com/jquery-latest.pack.js" ></script>
<script>
function on_submit()
{
$("input.require").each(function() {
if (this.value == '')
alert(this.name + ' is a required field')
})
}
</script>
<form>
<input class="require" name="Name" />
<input class="require" name="Email" />
<input class="require" name="Phone" />
<button type="button" onclick="on_submit()" >test</button>
</form>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.