如何查找具有特定属性且具有特定值的元素 [英] How to find an element with a specific attribute that has a specific value

查看:77
本文介绍了如何查找具有特定属性且具有特定值的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何查找具有属性"question-id"且等于特定值的元素? 从那里,我需要找到最近的div(此元素的包装器).

How do a find an element which has the attribute "question-id" and equals a specific value? From there, i need to find the closest div (the wrapper of this element).

谢谢

推荐答案

您可以使用属性等于选择器

$('[question-id="yourvalue"]').closest('div');

这篇关于如何查找具有特定属性且具有特定值的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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