Currently, there are three bootstrap carousels displayed on a single page.
These carousels are generated by a PHP loop, with the IDs always starting off as "carousel".
The issue arises because all the carousels initially have the ID and control href set to "carousel-1".
I am aware that this setup will cause all carousels to scroll the first one. To address this problem, I attempted to use the following jQuery code:
$('.second-block #carousel').attr("id","#carousel-2").find('.controls a').attr("href","#carousel-2");
$('.fourth-block #carousel').attr("id","#carousel-3").find('.controls a').attr("href","#carousel-3");
Although this code changes the IDs of the other carousels, it still causes only the first carousel to slide. Any suggestions for a solution?
Here is a Codepen link