I am a novice to jquery. I have a section with some items. on click over any item i want to open the modal form, so instead of creating multiple modal forms i created one modal and than using carousel inside it to go through the items.
Now if one clicks the 10th item i want to apply the carousel active class to the 10th item. For now i have given id to all of them and using following code for each item. But that is not a good approach.
I appreciate your help!
Thanks
$('.filtr-item .mod1').on('click',function(){
$('#menuCarousel').find('.active').removeClass('active');
$('.mod1_item').addClass('active');
});
$('.filtr-item .mod2').on('click',function(){
$('#menuCarousel').find('.active').removeClass('active');
$('.mod2_item').addClass('active');
});
$('.filtr-item .mod3').on('click',function(){
$('#menuCarousel').find('.active').removeClass('active');
$('.mod3_item').addClass('active');
});