<head>
<style>
#box {
width: 300px;
height: 60px;
background: green;
color: black;
font-size: 20px;
}
.images {
margin-top: 20px;
}
</style>
</head>
<body>
<div id="box">
<p style="padding: 20px;">Images Count:</p>
</div>
<div class="images">
<img src="img001.jpg">
<img src="img002.jpg">
<img src="img003.jpg">
<img src="img004.jpg">
<img src="img005.jpg">
<img src="img006.jpg">
</div>
Please help me with the code to display the count, count display needs to be in progressiveness counting.
You can try below code
$(document).ready(function(){ console.log("Images count="+ $(".images").find("img").length) $("#imgcount").text( $(".images").find("img").length) });
<div id="box"> <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"> </script> <p style="padding: 20px;">Images Count:</p> </div> <div class="images"> <img src="img001.jpg"> <img src="img002.jpg"> <img src="img003.jpg"> <img src="img004.jpg"> <img src="img005.jpg"> <img src="img006.jpg"> </div> Total No. of Images in page are <label id="imgcount">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.