Tags

, ,

Convert Address Text to Google Map using jQuery

css some styling

iframe{ width:100%; height:300px; }

html element

<address class="setmap">Eiffel Tower, Paris, France</address>

some javascript to do the magic

$("address.setmap").each(function(){
        var embed ="<iframe frameborder='0' scrolling='no'  marginheight='0' marginwidth='0'   src='https://maps.google.com/maps?&amp;q="+ encodeURIComponent( $(this).text() ) +"&amp;output=embed'></iframe>";
        $(this).html(embed);
});

To see working result click here

Advertisements