wrapper - jQuery: How to create element then wrap this around another existing element? -


so know how use .wrap, .wrapinner , .wrapall wondering how use quick creation syntax introduced in jquery 1.4 , wrap function together.

basically want able use

var targetul = $(this), // populated script     maxwidth = 1400;    // populated script  $('<div />', {     'id':'wrap',     'css': {         'width': maxwidth,         'overflow':'hidden'     } }).wraparound(targetul); 

kinda .appendto method works wrapping stuff…

can done?

thanks.

targetul.wrap(     $('<div />', {         'id':'wrap',         'css': {             'width': maxwidth,             'overflow':'hidden'         }     }) ); 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -