[英]jquery - find first previous node with certain properties
無論父/子關系等如何,如何找到具有特定屬性的最接近$(this)節點的節點,例如class =“ field”?
$(this).closest(".field");
這應該可以解決問題(假設.field是它的父級):
$(this).closest(".field");
$(this).parents(".field:first")
這並不是我最接近的意思,我最終這樣做是這樣的:
$(this).parent('.jdpicker_w').next('.spacer').children()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.