Hi… I have made a div’s with classes like slide1, slide2, slide3 and so on.
i want to add some js function to them. but one by one. on clicking a button on my page.
FOR EXAMPLE
I Have five div’s of same color, now i want them to be of different colors on clicking a button.
suppose all div’s are red. Now when i click a button i want the 2nd div to be blue and all other stay red. and again when i click the button, The 3rd div will be blue and all other stay red. and so on.
//
So i want to increase the number in slide’1’,slide’2’ and so on using js.
I had tried using for loops making i++ things but is did’t work
and some other things but they didn’t work as expected. so can anyone help me.
HERE IS THE CODE
<body>
<div class="quiz-field">
<div class="slides slide1">
</div>
<div class="slides slide2">
</div>
<div class="slides slide3">
</div>
<div class="slides slide4">
</div>
<div class="slides slide5">
</div>
</div>
<button onclick="myfun()">Click me</button>
</body>