如何使用JQuery在特定的div中获取img [英] How to get img inside a particular div using JQuery

查看:97
本文介绍了如何使用JQuery在特定的div中获取img的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须获取特定div内的所有图像标签ID.如何使用JQuery来获得它?

I have to get all the image tags ids inside a particular div. How can I get that using JQuery?

推荐答案

var arraysOfIds = $('#particularDivId img').map(function(){
                       return this.id;
                   }).get();

// arraysOfIds has now all the id's, access it as arraysOfIds[0], arraysOfIds[1]....  

这篇关于如何使用JQuery在特定的div中获取img的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆