Question

index.html file as below: This HTML is compiled with Handlebars

<div id="svg"></div>

index.js file as below:

var s = Snap("#svg");
var bigCircle = s.circle(150, 150, 100);

When i executed my code. It is showing me following error:

TypeError: s.circle is not a function
Was it helpful?

Solution

Your problem is that you are trying to attach Snap to a div element, instead of an SVG element.

Try changing

<div id="svg"></div> 

to

<svg id="svg"></svg> 

You can always put the svg inside a div.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top