How would I create an object in jQuery, and then proceed to make a couple of different instances of this object I.e
Create an object named box which holds a variable called color.
And then make a couple of instances of this object with different stored colours.
May be you want this (oop in javascript)
DEMO.
For more information.
You can always make it a function
writeObject('blue')
➜I actually found a better way using the jQuery approach
Another way to make objects in
Javascript
usingJQuery
, getting data from the dom and pass it to the object Box and, for example, store them in an array of Boxes, could be:Hope it helps!