Don't get this JS/jQ test

mayacove.com/dev/js_test.html

I don’t get this test… I don’t see an array defined anywhere… ("defined in the array “product_features”…)

(also: how do you move elements in jQuery from one element to another? I have done lots of things in jQuery, but never have had to move elements from one container to another…)

in the end I didn’t have to do this test, because they said the position was filled after they had sent me the test, but I still would like to tackle it…

thank you…

You are expected to create the array, and populate it with strings that would be matched against class names.

That would be with the appendChild method.


so it turns out there is an array there, hadn’t seen it…

var product_features = ['draggable','trackable','colorable'];

so I did:


        var prod_features = $('.draggable,.trackable,.colorable');
	$('#output').append(prod_features);
	

which did exactly what they wanted… :slight_smile: but they probably want me to do it using the array… how would I do this using the array??

also, found something very interesting…

I thought I would have to first remove the elements I need to move to the other div (there is a .remove() method), but it turns out that .append moves them, i.e., it removes elements from where they are, meaning it moves the elements, it doesn’t copy them… that’s cool… (so what if you want to copy them??)

thank you…

If you want to copy elements then use cloneNode to create a copy first and then append the copy.