I've got a list of hyperlinks that have a specific class assigned to them of "single-location". I need to add an EventListener to my Google Map that when a hyperlink is clicked, it will call the correct function. Can anyone help me?

Recommended Answers

All 2 Replies

Here this should help, so anyway you can see I have a link. Then in my javascript I get the id to the link and tie an event listener to it. When it is clicked it will fire the myFunction.

I hope this helps.

<a id="myTest" href="">This is a test</a>

var test = document.getElementById('myTest');
      function myFunction() {
        alert('it works!');

Awesome thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.