I think something as simple as this should work:
$("#maincontent, #left, #right").each(function() {
var content = $(this).html();
$(this).html('<div class="inject1"><div class="inject2"><div
class="inject3">'+content+'</div></div></div>');
});
Might get a bit more complicated if there are other javascript that
acts on the content. It might break some existing css also if they
bound to the current structure.
On Jul 17, 9:38 am, pennfoli0 <[email protected]> wrote:
> Hi,
>
> My CMS won't let me customize their HTML structure they didn't give me
> access to their templating system. But they'd let me access their Head
> section were I could add custom Javascript and CSS.
>
> Example this would be their template structure:
>
> <body>
> <div id="wrapper">
>
> <div id="maincontent"> Maincontent </div>
>
> <div id="left"> Left Contents </div>
>
> <div id="right"> Right Contents </div>
>
> </div>
> </body>
>
> This what I want to achieve:
>
> <body>
> <div id="wrapper">
>
> <div id="maincontent">
> <div class="inject1">
> <div class="inject2">
> <div class="inject3">
>
> Maincontent
>
> </div>
> </div>
> </div>
> </div>
>
> <div id="left">
> <div class="inject1">
> <div class="inject2">
> <div class="inject3">
>
> Left Contents
>
> </div>
> </div>
> </div>
> </div>
>
> <div id="right">
> <div class="inject1">
> <div class="inject2">
> <div class="inject3">
>
> Right Contents
>
> </div>
> </div>
> </div>
> </div>
>
> </div>
> </body>
>
> The reason why the injections was structured like that is, I want the
> regular divs to be rounded. the Inject1, Inject2, Inject3 would be
> style in my external CSS. To all JQuery experts there I really need
> help... I think it would also be great if it was like a class that i
> can just be apply it to specific ids or class.
>
> Thanks!