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!

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


build an interactive website > form validation & manipulation > query utility methods HELP

Hey. Merry Xmas!!

OK. So im stuck on question 1 in the jquery utility methods. it says ,

"Call 'map' on the inputs w/ the class 'required' and return each of there values and store it in a variable named 'values'

i dont know if how i am approaching this is the right way. im getting the wrong answer so i know its wrong but i dont know if im even headed in the right direction.

so far i got..

$("input.required").map(function (){ return ($(this).val(); })

I KNOW im missing the rest of it. and what i have probably isnt right. im just trying so hard and ive really been studying and watching your vids among other vids and i just dont know how to do this question. :*(

if you would help me that would be awsome. thanks

4 Answers

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

Merry Christmas too!

You're almost there!

You just need to do var values = before what you've done.

The map() method returns an array, by using the keyword var followed by values it will assign the resulting array to that variable.

If you're still stuck please let me know!

i had that before but i wasnt sure what to make it equal.. i had var values = $("input.required"); on the first line n then what i showed you and it said the values arent what we were expecting

oo i got it now..you just make it say var values = and then the rest..

var values = $("input.required").map(function(){ return $(this).val(); });

i was confused... i see what you were saying thanks lol sorry