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

completely lost at this point. i dont even understand what task2 is asking me to do or how to go about it.

example link

var email = "gbizzy@gmail.com"
function isValidEmail(email){
            return email.indexOf("@") != -1;
        };
function requiredValues(){
        var values = new Array();
               values.push(".required")
            });
        }

i finish task 1 and go to task 2 and i keep having to go back to task 1

5 Answers

Andrew Kiernan
Andrew Kiernan
26,892 Points

You're on the right track! Instead of jumping to the 'values.push' method, how would you store the elements with the class of "required"? You can store those in a variable, then call jQuery's 'each()' method and pass in the function to push the value of each element into the array. Then you can return the array of values.

Hopefully I made that coherent enough! If you're still stuck let me know and I'll post some code.

-Andrew

Andrew Kiernan
Andrew Kiernan
26,892 Points

Hey Charlie!

I know it can be frustrating. If you are having trouble with your knowledge of arrays and their methods, I would suggest taking a look at the JavaScript Foundations/Deep Dive. It goes over arrays and basic methods, among many other things, and is a great way to get the basics of JavaScript down. Give that a try, then when you come back to this it should make much more sense!

Let me know if you have any other questions!

-Andrew

Michel van Essen
Michel van Essen
8,077 Points

Thanks Andrew, I actually had the same problem as Charlie here - I didn't realize this Project was labeled as 'Advanced'. I was working through this as part of the WordPress track. Looking forward to work on the Javascript Foundations now.

Patrick Koch
Patrick Koch
40,496 Points

I just took the selectet fields (.required), put a method on it (each), and in this each-method I push the Value ( $(this).val()) of the field I selected to the array! and at the end return the array.

I hope it was a little bit helpfull.

PatPas

Thanks guys.

Charlie Parmentier
Charlie Parmentier
1,182 Points

I'm stuck on the same exercise and feeling pretty frustrated. I understand very little about arrays and .push() I feel it's not very well explained in the videos and the learning gradient is way too steep in my opinion.