So I'm trying to display a form only when a valid email address is entered.
<p>Email:</p>
<input name="User_Email" type="text"/>
<div id="outform">
<p>Company Name:</p>
<input type="text" name="CompanyName"/>
<p>Website:</p>
<input type="text" name="Website" />
<input type='submit'>
</div>
I first got the remainder of the form only to display if there was a value in the field with this:
<script>
$('input[name=User_Email]').keyup(function(){
if($(this).val().length)
$('#outform').show();
else
$('#outform').hide();
});
</script>
Which worked as expected, then I tried this which I can't get to work:
<script>
if $('input[name=User_Email]').is(':valid') {
$('#outform').show();
else
$('#outform').hide();
}
</script>
If anyone could help me udnerstand this isn't hitting the .is(':valid') clause it would be much appriciated.