Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.