<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style>
img{
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<img src="img/01.jpg">
<img src="img/02.jpg">
<img src="img/03.jpg">
<img src="img/04.jpg">
<img src="img/05.jpg">
<img src="img/06.jpg">
<script src="js/jquery-3.6.0.min.js"></script>
<script>
$(function(){
$('img').each(function(index){
console.log($(this).attr('title','第'+(index+1)+'图片'));
})
});
</script>
</body>
</html>