I want to append some svg tags and then inside svg tag I want to append circles and lines whose coordinates I am fetching from XML file.
I can append the same from jquery .append but I am not able to see anything in the browser although the tags are being appended in our DOM dynamically, but not able to see in the browser.
This is my code for fetching data from XML and the appending to the DOM:-
$(xml).find("Quadron").children().each(function(i){
var valueParameter=$(this).attr("value");
var riskParameter=$(this).attr("risk");
$('<circle/>',{
clicked:'plot'+i,
technology:$(this).parent().parent().attr("YearName"),
quadronName:$(this).parent().attr("title"),
class:'plot',
cx:dotsXposition,
cy:dotsYposition,
r:function(){
if(valueParameter=="high"){return 10;}
else if(valueParameter=="medium"){return 5;}
else if(valueParameter=="low"){return 2;}
},
fill:function(){
if(riskParameter=="high"){return "#b42a2d";}
else if(riskParameter=="medium"){return "#ebd62e";}
else if(riskParameter=="low"){return "#72aa2c";}
}
}).appendTo('#circlePlot');
$('<text/>',{
clicked:'plot'+i,
technology:$(this).parent().parent().attr("YearName"),
class:'plot',
text:$(this).text(),
x:dotsXposition+15,
y:dotsYposition
}).appendTo('#circlePlot');
dotsXposition+=10;
dotsYposition+=10;
});
}
I found the following code so that to refresh the page and to display the svg elemnts:- $("body").html($("body").html());
But after including this code in my java script file click events doesn't work.
Is there any way to solve this.