var gethtml = $('.app-bar td:nth-child(1)').clone();
$('.arrow-back').after($(gethtml).wrap("<div></div>"));
I can see the html block but it's not wrapped within div, anything wrong here?
Because .wrap() will not return the wrapped element(the div
) instead it will return the jQuery obeject on which it was called on, so you are still appending only the contents of gethtml
$('.arrow-back').after($(gethtml).wrap("<div></div>").parent());
Another way to do the same is
$('<div />', {
html: gethtml
}).insertAfter('.arrow-back')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.