I am looking for a way to clear the results of a geocomplete (version 1.5.0) control.I have tried the various ways that were mentioned here but to no avail.
The idea is when the user clears the field after entering a biz name I would like to have geocomplete also reset its "internals". Right now, though the field clears its input, as soon as it looses focus (user clicks elsewhere on the page), geocomplete puts back the address entered
<html>
....
<label for="geocomplete">Adress</label><input id="geocomplete" type="search" placeholder="Type you Address here" tabindex="1"/>
....
</html>
<javascript>
...
$("#geocomplete").geocomplete({
map: ".map_canvas",
mapOptions: {
zoom: 14,
scrollwheel: false,
mapTypeId: "roadmap",
streetViewControl:false,
mapTypeControl:false
},
types: ["establishment"],
}).bind("geocode:result", function(event, result) {
// do stuff here
});
//
$('#geocomplete').on('input', function() {
// Field empty... clear content
if($("#geocomplete").val() == "")
{
// Clear
//$('#geocomplete').data().autocomplete.term = null;
//$("#geocomplete").geocomplete().autocomplete()[0].value = "";
}
});
....
</javascript>