jQuery .wrap() isn't working

前端 未结 3 1593
心在旅途
心在旅途 2021-02-07 13:30

I\'m probably doing something wrong but I\'ve tried all sorts of things and can\'t seem to get a collection of jQuery objects wrapped. The following just outputs the link HTML,

3条回答
  •  广开言路
    2021-02-07 13:56

    jquery .wrap() returns the INNER element back to you, so it looks like nothing changed.

    $("
    ").wrap('') ===> [
    ]

    which looks like it didn't work.

    but:

    $("
    ").wrap('').parent() ===> [
    ]

    it actually did work.

提交回复
热议问题