I am trying to load simple svg file in HTML5 using JQuery. But i dont seem to get that effect in my page. Please help me solve this.
I have browsed and found the way, but it is not working for me. See my code below:
<?xml version="1.0" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="100" cy="50" r="40" stroke="black"
stroke-width="2" fill="red" />
</svg>
Script:
$(document).ready(function(){
$('#svgfile').svg({loadURL: 'Sample.svg'});
}
MyHtml.html:
<div id="svgfile" style="background:#9b0141;width:400px; height: 400px;">
$('#svgfile').svg({loadURL: 'Sample.svg'});
is not valid jQuery unless you are using some plugin you haven't mentioned.
try
$('#svgfile').load('Sample.svg');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With