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 Form Validation and Manipulation Checking Values

Marie Veverka
Marie Veverka
12,117 Points

JavaScript Checking Values Lesson

Hi there! I have been following along in the videos and I cannot seem to get my code to execute the same way it is in the video. I keep comparing my code to Andrew's and I can't seem to find what I am doing wrong. Can anyone help?

<script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript">
        var $submit = $(".submit input");
        var$required = $(".required");
        function containsBlanks(){
            var blanks = new Array();
                blanks.push($(this).val() == "";
                return blanks.sort().pop(); 

        function isValidEmail(email){
            returnemail.indexOf("@") != -1;

        function requiredFilledIn(){
            if(containsBlanks()) || !isValidEmail($("#email").val())) 

    $("#form span").hide();
    $("input, textarea").focus(function(){
        //Check all required fields.

        //Check for a valid email
        if(isValidEmail($(this).val)) $(this).next().removeClass("error").addClass("valid");
        else $(this).next().removeClass("valid").addClass("error");
Richard Duncan
Richard Duncan
5,568 Points

Could you provide the specific problem reported in the console?

Marie Veverka
Marie Veverka
12,117 Points

Hi Richard,

I just decided to start over from the beginning so hopefully I will catch whatever mistakes I made and it will work the second time around. Thanks!