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

Simon Lovelock
Simon Lovelock
5,537 Points

Another jQuery Challenge

Ok, so i'm gradually working my way through, think i will need to review a couple of times though. For now i've hit another issue with one of the challenges:

Create a method called 'requiredValues' that returns an array of all the values of inputs with the class of 'required'.

==================== My code:

function requiredValues(){ var $inputs = $(.required); var items = new Array();

$inputs.each(function(){ items.push($(this).val()); });

return items;
}

====================

Again any help would be greatly appreciated. I find that the Hints when you get something wrong aren't really that helpful which is ashamed.

2 Answers

Simon Lovelock
Simon Lovelock
5,537 Points

Apologies guys, solved it.

"solved it"

Woohoo! :D