Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
好的...如何选择具有指定类名的元素的父级子级..?
“元素的父母的孩子”被称为兄弟姐妹:
$(this).siblings(".theClassYou'reAfter")
$(this).parent("div").child(".className")
此外,父元素的子元素在技术上是当前元素的兄弟,因此您可以尝试:
$(this).siblings(".className")