16
在jquery中,如何引用$(this)
元素的父元素,class
的'abc'
?
在jquery中,如何引用$(this)
元素的父元素,class
的'abc'
?
像這樣:
$(this).parents('.abc');
或
$(this).parent('.abc');
或
$(this).closest('.abc');
.parent()
和.parents()
是除了.parent()
相似只有向上行進,在DOM樹一個級別。
<script>$(this).parent(".abc")</script>
謝謝。我知道這很簡單,我忽略了 – 2012-08-13 03:31:51