在jquery中,如何使用'abc'
的class
引用$(this)
元素的父元素?
最佳答案
像这样:
$(this).parents('.abc');
或
$(this).parent('.abc');
或
$(this).closest('.abc');
.parent()
和 .parents()
类似,只是 .parent()
仅在 DOM 树中向上移动一级。
关于jquery - 类名为 'x' 的引用 $(this).parent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11927854/