Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I currently build my Carousel in my JS from my XML file, where I declare img path etc. Now I have the issue that my Carousel contain just one image sometimes and if that's so, I want to hide my carousel-control and my carousel-indicators

How can I check in JS if there is more than one Image ?

https://i.stack.imgur.com/1qWqJ.png[^]

Thanks in advance.

What I have tried:

I've seen many examples in different languages but nothing with JavaScript/JQuery.
Posted
Comments
Member 15627495 2-Sep-22 8:53am    
hello !

you can count the img inner the carousel pattern tags.

in js :
var number = document.getelementByTagName('the images inner carousel img')
number.length // equal the size of the array

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900