markmarkoh / datamaps

Customizable SVG map visualizations for the web in a single Javascript file using D3.js
http://datamaps.github.io
MIT License
3.78k stars 1.01k forks source link

Uncaught TypeError: t.querySelector is not a function #443

Open protonhs opened 6 years ago

protonhs commented 6 years ago

Hello , I implemented everything as in the examples, in local, I have this error : d3.v3.min.js:3 Uncaught TypeError: t.querySelector is not a function at No (d3.v3.min.js:3) at w.fn.init. (d3.v3.min.js:1) at Array.Co.select (d3.v3.min.js:3) at new m (datamaps.world.min.js:1) at details.html?id=2:206

Any solution?

achanta3215 commented 4 years ago

tldr; I found i was using jquery instead of document.getElementById.

Code:

new Datamap({
      element: $('#india'),
})

instead of what was mentioned in the docs,

new Datamap({
      element: document.getElementById('india'),
})