I came across a forum post where user was experiencing problems while using Digg this (diggthis.js) button code with jQuery’s .wrap()
method. According to him Mozilla Firefox (FF) is freezing and Apple Safari is crushing when he tries to wrap the div that contains diggthis.js file with another new div like so:
<div class="rounded"> <script type="text/javascript"> digg_url = "myURL.com"; </script> <script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script> </div>
And the jQuery code is:
$(document).ready(function(){ $("div.rounded").wrap('<div></div>'); });
This code seems to crush those browsers. Another way to do this is to remove the div that contains the script (.rounded
), then create a new <div>
and then insert the removed div (.rounded
) back into the newly created div like this:
$(document).ready(function(){ $("div.rounded").remove().wrap('<div></div>').appendTo("#somewhere"); });