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

问题描述

如何查找具有属性"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');

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

08-03 18:26
查看更多