Can anyone please help me with this bit of code.I do not understand what is wrong and why it's not performing. Thanks.
var i = 0;
$('.course-testimonial-wrapper .testimonial-content-text').each(function() {
// console.log(i);
$(this).attr('id', 'testimonial-' + i);
$(this).append('<div class="description-overlay" id="d-over-' + i + '"></div>');
$(this).after('<div><button class="btn green show-more-' + i + ' shadow-0 p-0 medium" style="font-size: 14px;">Mostra di più <i class="fi-rr-angle-small-down"></i></button></div>');
$('.show-more-' + i + '').click(function() {
$('#testimonial-' + i + '').toggleClass('expand');
$('#d-over-' + i + '').toggleClass('d-none');
if ($('#testimonial-' + i + '').hasClass('expand')) {
$('.show-more-' + i + '').html('Mostra di meno <i class="fi-rr-angle-small-up"></i>');
} else {
$('.show-more-' + i + '').html('Mostra di più <i class="fi-rr-angle-small-down"></i>');
}
})
i++;
})