I can also share snippets along the way if that's simpler. :)
I'm making a <ul> of objects using jQuery as soon as my page loads. I used a constructor to make a bunch of Fruits
Now that I have my Fruits I want to sort them. I want to have two buttons on the page. One that will sort them by calories, one that will sort them by gLoad.
Rachel Kudrna
@rkudrna
...
so, here's where I get confused
I need to make an array of Fruits
I can do that by passing my variable names into an array, but that doesn't seem to be an interaction with the DOM. Right?
I'm thinking there's a way to query for all <li>s, but will they maintain their status as objects with properties I can sort them by?
Samantha Camus
@xdothackerx
Uhhh give me a minute to download all your stuff and take a look. XD
Rachel Kudrna
@rkudrna
sure thing. :) Let me know when you've had a chance to take a peek.
Samantha Camus
@xdothackerx
Is there a reason why you want to query the DOM for the fruit objects instead of just adding them to an array when they're instantiated?
Rachel Kudrna
@rkudrna
I'm thinking of adding an animation of the sorting. Can I do that when I'm just adding them to the array in the js file?
(it's entirely possible that I'm overthinking how this ought to work)
Samantha Camus
@xdothackerx
It'd probably be easier to add them to an array when they're instantiated, then have animations during each of the two sort functions.