Find a random set of elements and appendChild
I placed all the Elements necessary, which shows the full structure but can't seem to figure out how I can make each object to click on randomly generate.
This is my fiddle, http://jsfiddle.net/JoshuaWaheed/XaUyE/1/
I've written this,
var newLI = Math.random(li.appendChild(span));. What I'm trying to tell the program is, "Choose a random set of li's and append a tag into it, which will be clickable," but for some reason it's appending it into all the li's, which I know can be written as
What can I do to fix this? Also is there an event listener of some sort that can see if all the buttons have been clicked and does another random select and append?
Math.random() returns a number between 0 to 1.
You could use the following condition to have some code run or not run randomly:
see how it applies to your code: http://jsfiddle.net/SpacePineapple/XaUyE/3/
This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here