javascript - Cannot use selector to select Google's autocomplete suggestion element? -


i have been fighting google today. have functioning autocomplete on input field id "locationsearch".

what want able , grab suggestions google's autocomplete seems can't select ".pac-container" class google uses populate suggestions.

my code this:

<!doctype html> <html> <head>    <meta charset="utf-8" />    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false&language=se"></script>    <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>    <script>     function init() {        // make autocomplete       var input = document.getelementbyid("locationsearch");       var options = { componentrestrictions: {country: 'se'} };       var autocomplete = new google.maps.places.autocomplete(input, options);        // try see if can click on google's suggestion list       $(".pac-container").on("click", function(){          alert("clicked on pac");       });     }    google.maps.event.adddomlistener(window, 'load', init);     </script> </head> <body><input id="locationsearch" type="text" onchange=""></input></body> </html> 

any idea on why doesn't work?


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -