Created
March 5, 2021 16:31
-
-
Save carmoreira/20d5d20cb6e48762a6320ac99ff0f011 to your computer and use it in GitHub Desktop.
Create Button to clear content that displays after map is clicked - Interactive Geo Maps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this assumes there's at least one element on the page with the class clear_map_info | |
document.querySelectorAll('.clear_map_info').forEach( | |
function(button) { | |
button.addEventListener('click', function(event) { | |
// If the clicked element doesn't have the right selector, bail | |
if (!event.target.matches('.clear_map_info')) return; | |
// Don't follow the link | |
event.preventDefault(); | |
// Clear map content action - CHANGE WITH YOUR MAP ID | |
iMapsActions.resetActions(15751); | |
}, false); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment