Google Map from Address

Generate google map from address.

It is possible and very easy! Just add one or more

tags with your addresses. The jQuery function will automatically turn the

element into a Google map in your html webpage. Check it out.

Instructions for how to dynamically generate google map from address:

Just add the following html and jQuery code into your html document. Make sure you have included the basic jQuery library inside the of your html document to get the jQuery to work. Change the iframe width or height to suit your needs.

HTML:

1
<address>Mystreet 123</address>

Jquery Script:

1
2
3
4
5
6
$(document).ready(function(){
$("address").each(function(){
var embed ="<iframe width='425' height='350' 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);
});
});

Leave a Reply