I have a HTML construction that resembles the following code:
//draw some svg elements <
//draw some svg elements
If you're dealing with svg's a lot using JS, I recommend using d3.js. Include it on your page, and do something like this:
d3.select("#svg1").append("circle");