• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

jQuery


CSparkes

Senior Member
#1
Hi,

Quick question, any know the calling need to use so that in site JQuery manipuates a div and adds in.

Example.

HTML Code

HTML:
<div id="content">ORIGINAL CONTENT</div>
What Needs to be seen by browser

HTML:
<div id="content">
<div id="top"></div>
<div id="middle">ORIGINAL CONTENT GOES IN THIS TAG</div>
<div id="bottom"></div>
</div>
So can add some styling top it across a site without having to copy each of the above, design of site is stipulating above and will change quite often.

Have an example done in Javascript but need to do via JQuery.

Cheers

Craig
 

tbwcf

Active Member
#2
Something like this should work

$(function() {
$("#content")
//create div id middle around text
.wrapInner("<div id='middle'></div>");
//put divs before and after #middle
$("#middle")
.before("<div id='top'></div>")
.after("<div id='bottom'></div>");
});