node2:/var/www/html/js#cat h32.html
<html>
<body>
<img src="009.jpg" alt="纽约" height="400" width="400" />
<img src="003.jpg" alt="上海" height="400" width="400" />
<img src="002.jpg" height="400" width="400" />
<img src="002.jpg" alt="北京" height="400" width="400" />
</body>
</html>
<script type="text/javascript" src="jquery-2.2.2.min.js"></script>
<script type="text/javascript" src="h32.js"></script>
node2:/var/www/html/js#
node2:/var/www/html/js#cat h32.js
var img=$('img[alt]').get(2);
console.log(img);
![](https://img-blog.csdnimg.cn/20190212103533669.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3poYW95YW5namlhbjcyNA==,size_16,color_FFFFFF,t_70)