The code is used for google maps api to autocomplete the search address. I must convert it because of a conflict in my joomla site. How would I achieve the same with Mootools 1.4? Some help will be much appreciated!
Here is the code:
$(document).ready(function() {
initialize();
$(function() {
$("#entry_3").autocomplete({
//This bit uses the geocoder to fetch address values
source: function(request, response) {
geocoder.geocode( {'address': request.term }, function(results, status) {
response($.map(results, function(item) {
return {
label: item.formatted_address,
value: item.formatted_address,
latitude: item.geometry.location.lat(),
longitude: item.geometry.location.lng()
}
}));
})
},
//This bit is executed upon selection of an address
select: function(event, ui) {
$("#entry_4").val(ui.item.latitude);
$("#entry_5").val(ui.item.longitude);
var location = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
marker.setPosition(location);
map.setCenter(location);
}
});
});
});
Edit:
It is wrong to add window.onunload = GUnload; in google maps api v3. It’s a v2 function. v3 don’t need onunload. And that messed up the autocomplete function.
You don’t need to write code in mootools just use
jquery no conflict
http://docs.jquery.com/Using_jQuery_with_Other_Libraries