document.addEventListener("DOMContentLoaded", function () { // Check if the mapInput class exists const mapInput = document.querySelector(".mapInput"); if (mapInput) { const mapContainer = document.querySelector(".mapContainer"); const mapCancel = document.querySelector(".map_cancel"); //Load map if iframe data exists if (mapInput.value) { mapContainer.innerHTML = mapInput.value; } //Load iframe on input map data mapInput.addEventListener("input", function () { //Show map inside div mapContainer.innerHTML = mapInput.value; }); //Load default if click cancel button mapCancel.addEventListener("click", function () { mapContainer.innerHTML = mapInput.value; }); } });