I have this uncaught referenceerror function is not defined error which do not understand.
If I have
$(document).ready(function(){
function codeAddr
How about removing the onclick
attribute and adding an ID:
<input type="image" src="btn.png" alt="" id="img-clck" />
And your script:
$(document).ready(function(){
function codeAddress() {
var address = document.getElementById("formatedAddress").value;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
}
});
}
$("#img-clck").click(codeAddress);
});
This way if you need to change the function name or whatever no need to touch the html.