hello,
this code works fine the only problem is when user press tab on any row of google api it does not select that row i want when user press tab on any row of google adddress that address select please advice
<script type="text/javascript">
$(function () {
var textbox1 = $(this).find('[id*=txtfrom]');
var textbox2 = $(this).find('[id*=txtto]');
ApplyAutoComplete(textbox1);
ApplyAutoComplete(textbox2);
});
function ApplyAutoComplete(input) {
google.maps.event.addDomListener(window, 'load', function () {
var places;
for (var i = 0; i < input.length; i++) {
var options = { types: ['(regions)'] };
places = new google.maps.places.Autocomplete(input[i], options);
}
google.maps.event.addListener(places, 'place_changed', function () {
isPlaceChanged = true;
var place = places.getPlace();
var address = place.formatted_address;
var mesg = "Address: " + address;
});
});
}
var source, destination;
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
function initialize(textBox) {
var input = textBox;
var options = {
types: ['(regions)']
// Uncomment if restrict for Country.
//, componentRestrictions: { country: 'in' }
};
var autocomplete = new google.maps.places.Autocomplete(input, options);
}
google.maps.event.addDomListener(window, 'load', function () {
initialize(document.getElementById('<%=txtfrom.ClientID%>'));
initialize(document.getElementById('<%=txtto.ClientID%>'));
directionsDisplay = new google.maps.DirectionsRenderer({ 'draggable': true });
})
$(function () {
$('#<%= txtfrom.ClientID %>').keydown(function () {
isPlaceChanged = false;
});
$('#<%= txtfrom.ClientID %>').blur(function () {
if (!isPlaceChanged) {
<%-- $('#<%= TextBox1.ClientID %>').val('');--%>
var valName = document.getElementById("<%=RequiredFieldValidator3.ClientID%>");
ValidatorEnable(valName, $('#<%= txtfrom.ClientID %>').val(''));
//alert("Please Enter valid location");
}
else {
a<%--lert($('#<%= TextBox1.ClientID %>').val());--%>
var valName = document.getElementById("<%=RequiredFieldValidator3.ClientID%>");
ValidatorEnable(valName, $('#<%= txtfrom.ClientID %>').val(''));
}
});
});
</script>