jQuery Wrap Not Working?
Are you trying to use .wrap() in jQuery only to find it isn’t working?
Something the docs don’t tell you is that you can only wrap elements that are attached to the DOM! Important.
Take for example:
$("<a href='#'>My Link</a>").wrap("<li></li>").appendTo("ul:first").click(function() { ... } ); // will not work
$("<a href='#'>My Link</a>").appendTo("ul:first").wrap("<li></li>").click(function() { ... } ); // will work fine!
Loading...
