0

I have a bootstrap carousel page showing images and the current & total number of images on the page. I've used the code from other questions on this forum to get the image counters working, and what I would like to do next is capture the current image number in a form to pass it to a php script, so I can modify the image via php as needed.

My current code is:

$(window).load(function(){

var totalItems = $('.item').length;

var currentIndex = $('div.active').index() + 1;
$('num').html(''+currentIndex+'');
document.getElementById("num").innerHTML = "The current is: " + currentIndex;

$('#myCarousel').on('slid.bs.carousel', function() {
currentIndex = $('div.active').index() + 1;
$('num').html(''+currentIndex+'');
document.getElementById("num").innerHTML = "The current is: " + currentIndex;
});
});

And then:

<p id="dum"></p>

How can I modify this to capture the current image number in a html form?

Community
  • 1
  • 1

0 Answers0