ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Validate Google Autocomplete address on TextBox Tab Key press using JavaScript and jQuery<p>Hi <a class="username" rel="nauna"> nauna</a>,</p> <p>Refer below sample.</p> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <pre class="brush: html">&lt;asp:Content ID=&#34;Content2&#34; ContentPlaceHolderID=&#34;ContentPlaceHolder1&#34; runat=&#34;Server&#34;&gt; &lt;link rel=&#34;stylesheet&#34; href=&#34;https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css&#34; /&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://maps.googleapis.com/maps/api/js?libraries=places&amp;key=API_Key&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; var fromAddress; var toAddress; $(function () { var textbox1 = $(this).find(&#39;[id*=txtfrom]&#39;); var textbox2 = $(this).find(&#39;[id*=txtto]&#39;); ApplyAutoComplete(textbox1); ApplyAutoComplete(textbox2); $(textbox1).blur(function () { var address = $(this).val(); if (address == fromAddress) { $(&#39;[id*=lblFrom]&#39;).hide(); } else { $(&#39;[id*=lblFrom]&#39;).show(); } }); $(textbox2).blur(function () { var address = $(this).val(); if (address == toAddress) { $(&#39;[id*=lblTo]&#39;).hide(); } else { $(&#39;[id*=lblTo]&#39;).show(); } }); }); function ApplyAutoComplete(input) { google.maps.event.addDomListener(window, &#39;load&#39;, function () { var places; for (var i = 0; i &lt; input.length; i++) { var options = { types: [&#39;(regions)&#39;] }; places = new google.maps.places.Autocomplete(input[i], options); } google.maps.event.addListener(places, &#39;place_changed&#39;, function () { if ($(input)[0].id == $(&#39;#&lt;%=txtfrom.ClientID%&gt;&#39;)[0].id) { fromAddress = places.getPlace().formatted_address; $(&#39;[id*=txtfrom]&#39;).val(fromAddress); $(&#39;[id*=txtfrom]&#39;).trigger(&#34;blur&#34;); } else if ($(input)[0].id == $(&#39;#&lt;%=txtto.ClientID%&gt;&#39;)[0].id) { toAddress = places.getPlace().formatted_address; $(&#39;[id*=txtto]&#39;).val(toAddress); $(&#39;[id*=txtto]&#39;).trigger(&#34;blur&#34;); } }); }); }; &lt;/script&gt; &lt;div class=&#34;form-group col-md-2 padding2&#34;&gt; From : &lt;asp:TextBox ID=&#34;txtfrom&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt; &lt;span id=&#34;lblFrom&#34; style=&#34;display: none; color: Red;&#34;&gt;Select valid origin from address list&lt;/span&gt; &lt;/div&gt; &lt;div class=&#34;form-group col-md-2 padding2&#34;&gt; To : &lt;asp:TextBox ID=&#34;txtto&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt; &lt;span id=&#34;lblTo&#34; style=&#34;display: none; color: Red;&#34;&gt;Select valid destination from address list&lt;/span&gt; &lt;/div&gt; &lt;/asp:Content&gt;</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><strong><span style="text-decoration: underline;"><img src="https://i.imgur.com/zjc0fHM.gif" alt="" width="472" height="293" /></span></strong></p>https://www.aspforums.net:443/Threads/122258/Validate-Google-Autocomplete-address-on-TextBox-Tab-Key-press-using-JavaScript-and-jQuery/https://www.aspforums.net:443/Threads/122258/Validate-Google-Autocomplete-address-on-TextBox-Tab-Key-press-using-JavaScript-and-jQuery/Mon, 03 Jun 2019 03:35:01 GMT