I am building a “universal wrapper” for several different external sites that would build a nav and footer with jquery and xml.
My problem: Since the script will be used on multiple sites that were built by other people, I need to build a container out just inside the opening and closing body tags. I have been able to target the body to prepend <div id="wrapper">, but I need to close the div somehow and trying to append only </div> does not work.
This is what I’m trying to do:
$(document).ready(function(){
$("body").append("</div>");
});
My question: Is there a way to render </div> on its own?
Have you looked at .wrapInner()? It will allow you to wrap all of the contents of
<body></body>with a starting and ending tag:That will result in:
Caution: One thing I noticed was the fact that jQuery will create the wrapper twice if the script is ran from within the body tags.