I think the easiest way is to create an inner div inside the original div and initialize the map for the inner div. When destroying a map, simply delete the inner div and it.
var $inner = $('<div style="width: 100%; height: 100%"></div>').appendTo('#map_div'); // creation: var map = new google.maps.Map($inner[0], { ... }); // removal: $inner.remove();
Without jquery:
document.getElementById('map_div').innerHTML = '<div id="inner_map_div" style="width: 100%; height: 100%"></div>'; // creation: var map = new google.maps.Map(document.getElementById('inner_map_div'), { ... }); document.getElementById('map_div').innerHTML = ''; // removal
source share