Check if an element is a child of a parent

后端 未结 7 896
故里飘歌
故里飘歌 2020-12-07 19:54

I have the following code.



    

        
7条回答
  •  无人及你
    2020-12-07 20:07

    You can get your code to work by just swapping the two terms:

    if ($(target).parents('div#hello').length) {
    

    You had the child and parent round the wrong way.

提交回复
热议问题