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

varis darasirikul
varis darasirikul
10,832 Points

Troubles with jquery Challenge task (again!)

Create a method called 'requiredValues' that returns an array of all the values of inputs with the class of 'required'. And i already wrote this below.

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

var $required = $(".required");
function containsBlanks(){
            var blanks = $required.map(function(){ return $(this).val() == "";});
            return $.inArray(true, blanks) != -1;
        }

it doesnΒ΄t work. and i don't know what wrong? and this is link to a Challenge task (task 2) http://teamtreehouse.com/library/build-an-interactive-website/form-validation-and-manipulation/checking-values

3 Answers

var requiredValues = function() { var myArray = new Array(); $('.required').each(function() { myArray.push($(this).val()); }); return myArray; }

James Barnett
James Barnett
39,199 Points

Remember our goal on the forum is give help not answers, next try giving an explanation and/or a hint instead.

Need more explanation on the distinction check this out.

varis darasirikul Up vote and close the question if it is solved.

Your welcome :)