So I'm trying to get the number of the li that I click and show the corresponding page text while hiding the others. (labeled #text1, #text2, #text3 etc...), but the code below isn't doing anything for me.
Help is greatly appreciated!
var j = 0;
$(".gallery li").each(function () {
j++;
$(".gallery li").click(function () {
var num = $(this).index() + 1;
$('#text' + num).addClass('currentpage');
$('#text' + num).siblings().removeClass('currentpage');
});
});