Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Build an Interactive Website jQuery Plugins Simple Email Validation Plugin

Simple Email Validation Plugin Question

I have tried this and it is not working; I have gone through it twice and still is not working. I lost the "@" validation along with not gaining text input validation. Here is the code I input.

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/validEmail.js"></script><script type="text/javascript">
    var $submit = $(".submit input");
    var $required = $(".required");
    function containsBlanks(){
    var blanks = $required.map(function(){return $(this).val() == "";});
    return $.inArray(true, blanks) != -1;
    }

function requiredFilledIn(){
if(containsBlanks() || !$("#email").validEmail())
    $submit.attr("disabled","disabled");
else 
    $submit.removeAttr("disabled");
}

$("#form span").hide();
$("input, textarea").focus(function(){
$(this).next().fadeIn("slow");
}).blur(function(){
    $(this).next().fadeOut("slow");
}).keyup(function(){
//Check all required fields.
requiredFilledIn();
});
$("email").validEmail({on:"keyup", success:function(){$(this).next().removeClass("error").addClass("valid");
}, failure:function(){
$(this).next().removeClass("valid").addClass("error");
}});

requiredFilledIn();
</script>

2 Answers

Near the bottom of your code you don't have # in front of email. $("#email").validEmail...

That was it!. Thank you Jason.