使用jQuery获取图像ID [英] Get the image id using jquery

查看:86
本文介绍了使用jQuery获取图像ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在获取图像内容并将其存储在变量中.

I am getting the image content and stored it in the variable.

如何使用jquery获取图像的ID.

How do i get the id of the image using jquery.

var imageContent = "<img src='http://xxxx.com' width='30' height='40' id='img_123' />";

推荐答案

创建一个jQuery对象并获取其ID

Create a jQuery object and get its id

$(imageContent).attr('id')

演示

这篇关于使用jQuery获取图像ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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