4

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
Ashwin Hegde
  • 1,733
  • 4
  • 19
  • 49

1 Answers1

10

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.

Ian
  • 13,724
  • 4
  • 52
  • 75