jQuery - selecting elements from inside a element

前端 未结 7 1571
广开言路
广开言路 2020-12-02 08:19

let\'s say I have a markup like this:

... ... ...

and

7条回答
  •  一向
    一向 (楼主)
    2020-12-02 09:03

    Actually, $('#id', this); would select #id at any descendant level, not just the immediate child. Try this instead:

    $(this).children('#id');
    

    or

    $("#foo > #moo")
    

    or

    $("#foo > span")
    

提交回复
热议问题