Hi nauna,
I have simplified the code. Refer below sample.
HTML
<script type="text/javascript">
$(function () {
ApplyAutoComplete($('[id*=txtosearch]'));
ApplyAutoComplete($('[id*=txtdsearch]'));
});
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 () {
$(input).parent().find('input').eq(1).val(places.getPlace().formatted_address);
$(input).val('');
$(input).parent().find('input').eq(1).trigger("blur");
});
});
};
</script>
<div class="form-group col-md-2 padding2">
<span class="none">Origin </span>
<asp:TextBox ID="txtosearch" runat="server"></asp:TextBox>
<asp:TextBox ID="txtfrom" runat="server"></asp:TextBox>
</div>
<div class="form-group col-md-2 padding2">
<div runat="server" id="destination">
<span class="none">Destination </span>
<asp:TextBox ID="txtdsearch" runat="server" Height="22px"></asp:TextBox>
<asp:TextBox ID="txtto" runat="server"></asp:TextBox>
</div>
</div>
Screenshot