(function pacSelectFirst(input) {
// Store the original event binding function
var _addEventListener = (input.addEventListener) ? input.addEventListener : input.attachEvent;
function addEventListenerWrapper(type, listener) {
// Simulate a 'down arrow' keypress on hitting 'return' when no pac suggestion is selected, and then trigger the original listener.
if (type === "keydown") {
var orig_listener = listener;
listener = function (event) {
var suggestion_selected = $(".pac-item-selected").length > 0;
if (event.which === 13 && !suggestion_selected && block) {
var simulated_downarrow = $.Event("keydown", {
keyCode: 40,
which: 40
});
orig_listener.apply(input, [simulated_downarrow]);
}
orig_listener.apply(input, [event]);
};
}
_addEventListener.apply(input, [type, listener]);
}
input.addEventListener = addEventListenerWrapper;
input.attachEvent = addEventListenerWrapper;
})(input);
// split
google.maps.event.addListener(autocomplete, 'place_changed', function () {
circle.removeClass('flip');
side1.removeClass('bounce').css('opacity', 0);
mapCanvas.css('opacity', 1);
var place = autocomplete.getPlace();
if (place.geometry) { // Check to see if we have the appropriate information to display the place.
var displayAddress = '';
var address = [];
if (place.address_components) { // If the address components exist,
for (var i = 0; i < place.address_components.length; i++) { // Iterate through address_component types
if (place.address_components[i].short_name) {
if (place.address_components[i].types[0] === 'street_number') { // If there is street number information,
address[0] =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.