I am having problems with my code. It should take an object containing 4 strings and using a function it should create 4 rectangles which the user can click on. Once the user clicks on a rectangle I am applying some animation to it before it disappears. I then want to return the exact one that was clicked and then repeat this with a new function.
Apologies if that is confusing, I have a JFiddle here: http://jsfiddle.net/rickdonohoe/dpPj7/ which should show it.
My problems are:
-
It haven’t been able to change the html content based on the object of strings passed into the function.
-
I’m not sure how to return the one which was clicked.
-
In the each() function each div is created with a class of four_q1. I want this to increment for all 4 with four_q2 etc How do I do this?
Oh and this is my first JFiddle so any problems or criticism please let me know!
Thank You,
Rick
I messed with it, stripped some junk out, and got this… it should start you in the right direction.
Remember, you can’t parse an object for each element in a standard format, try an array instead.
Also, it’s a bad idea to pass jQuery objects around. Instead try passing the selector.
http://jsfiddle.net/dpPj7/20/
//===== After Comments ======
http://jsfiddle.net/dpPj7/33/