我有一个带有this
变量的jquery对象的引用。我正在寻找一种将子选择器应用到对象的方法。有没有这样的事情作为一个相对的jQuery选择器?
我使用的是$(this).find('table > tbody > tr > td')
,但我想要的更像$('[Value of $(this) goes here somehow] > table > tbody > tr > td')
。
我意识到我可以做$(this).children('table').children('tbody').children('tr').children('td')
,但我想知道是否有一些我可以在这里使用的语法糖。
为什么没有_I_想到那个? – Eric 2010-08-23 10:56:09
你实际上可以使用'>'选择器而没有任何东西在它前面? *刮头*这当然是无效的CSS,我没有看到它在API页面中提到...嗯...现在就试试 – 2010-08-23 10:56:28
@Yi Jiang:这样的东西在CSS中没有意义,因为有没有上下文。在JavaScript/jQuery选择器中,它更有意义。 – 2010-08-23 11:00:18