maya90 — 2012-08-22T18:30:43-04:00 — #1
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...
paul_wilkins — 2012-08-22T19:00:48-04:00 — #2
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.
maya90 — 2012-08-22T21:45:54-04:00 — #3
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');
which did exactly what they wanted... 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??)
felgall — 2012-08-22T22:13:16-04:00 — #4
If you want to copy elements then use cloneNode to create a copy first and then append the copy.