I’ve searched up and down google and haven’t found a simple solution.
Here is the jist of my code:
var theArray = ["one","two","three","four"];
$('.next').click(function(){
// go forward on the array
})
$('.back').click(function(){
// do backwards on the array from the current position
})
so, if the user clicks on "<button class="next"> I would get an alert of “one”, they click on “next” again, an alert of “two”, etc…
Is there a quick way to do this?
You’ll need a second variable to keep track of your index: