0

I'm working on drawing arcs between countries in datamaps. I've added country coordinates to each country path, but i want to retrieve that information now by selecting on tag name (as that is how they are marked)

    <body>
        <div id="map" class="container" style="position: relative; width: 1000px; height:600px;">
    <svg style="overflow: hidden;" height="605" class="datamap" data-width="1005" width="1005"><g class="datamaps-subunits" id="">
    <path y="428.1202655740264" x="434.98315269028086" style="fill: rgb(255, 255, 0); stroke-width: 1; stroke-opacity: 1; stroke: rgb(253, 253, 253);" class="datamaps-subunit FRA" d="M540.4628749226546...377.01608532029195Z
</path></svg>
        </div>   
    </body>

I want to select this specific element and retrieve the x and y values. But document.getElementByTagName("datamaps-subunit FRA").length returns 0. What do i do wrong here?

  • Possible duplicate of [How to get element by class name?](http://stackoverflow.com/questions/17965956/how-to-get-element-by-class-name) – Mark Amery Jan 24 '16 at 15:40

1 Answers1

1

Should be getElementsByClassName

mgraham
  • 6,147
  • 1
  • 21
  • 20