In my html I have a div id="mainWrapper" that I want to insert html markup that I created in an external js file. How can I do this without eliminating any existing divs inside "MainWrapper"? I want the external markup to be a child of "mainWrapper". Below is my external JS file and the HTML file.
//External mainScript.js file//
var pageContent = {
skinImg: "images/staticTO_SKIN_000000.jpg",
leaderBoardImg: "images/staticTO_LEADERBOARD.jpg"
}
function renderLB(){
var markup ='\
<div id="leaderBoard"><img src='+pageContent.leaderBoardImg+'> </div>\
<style>\
#leaderBoard{width:1200px; height:82px; position:relative;top:0px}\
#pageContent{top: 65px;}\
</style>'
renderMarkup(markup);
}
renderLB();
function renderMarkup(markup){
}
<html>
<head>
<title> </title>
<style>
body{
padding: 0px;
margin: 0px;
}
#mainWrapper{
width: 1200px;
margin: 0 auto;
height: auto;
}
#pageContent{
position: relative;
width: 1200px;
height: 953px;
}
</style>
</head>
<body id="body">
<div id="mainWrapper">
<div id="pageContent"><img src="images/pageSkin.jpg"> </div>
<div>
<script src="mainScript.js"> </script>
</body>
</html>