have a next question:
i.g. we have next html with structure:
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$($("#global").attr("innerHTML")).wrap('<div name="wrapper"></div>');
})
</script>
</head>
<body>
<div id="global">
<div id="container">
<div id="sub1">
<h1> hello world </h1>
</div>
<div id="sub2">
<h1> hello world again</h1>
</div>
</div>
<div id="container3">
<h1> hello world again</h1>
</div>
</div>
</body>
</html>
but wrap function, some why won’t work on it, as I think, it happens, because innerHTML hasn’t parent, so, how can i avoid this, and wrap few elements (which has ‘one level’ and common parent)?
try
demo