var nameOfSlide = $('#sliderTop .slider').eq(currentSlide).attr('data-title'); console.log(nameOfSlide); $('.prev-link .name').html(nameOfSlide);