jQuery find does not seem to work

后端 未结 5 706
南方客
南方客 2020-12-19 10:32

I have a DocumentFragment stored in \"selectedContents\", and I am trying to find \"span\" elements in it, with the help of jQuery. It has two child nodes, where the first o

5条回答
  •  旧时难觅i
    2020-12-19 10:58

    With $(selectedContents.childNodes) you already selected all elements from the selectedContents. So doing a find would execute the method on the first element of that selector.

    Try this one:

    $(selectedContents).find('span')
    

提交回复
热议问题