I have a block of code that I want to try and refactor.
$(function () {
$('.dots:nth-of-type(1)').click(function () {
currentSlide(1);
});
$('.dots:nth-of-type(2)').click(function () {
currentSlide(2);
});
});
How can I make the nth-of-type(1) dynamic along with the currentSlide(1) so that for each nth-of-type(), I just need to click on it in order currentSlide to be the same?