Prepend divs without closing them

前端 未结 1 1340
栀梦
栀梦 2020-12-04 03:23

I want to prepend the following within a div using Jquery:

1条回答
  •  無奈伤痛
    2020-12-04 04:01

    You can't.

    Despite the abstraction it offers, jQuery doesn't operate on HTML, it operates on a DOM (where there are no start tags and no end tags, just elements).

    Build the DOM you want to prepend, and then prepend it.

    var $wrapper = $('
    '); var $inner = $('
    ') var $col = $('
    '); $inner.prepend($col); $wrapper.prepend($inner); $('.mpfy-tags-list').prepend($wrapper);

    0 讨论(0)
提交回复
热议问题