Results 1 to 1 of 1

Thread: Google Maps Directions - Get directions by hitting enter

  1. #1
    Thread Starter
    Newbie push7's Avatar
    Join Date
    May 2012
    Location
    United States
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Google Maps Directions - Get directions by hitting enter

    I found the tutorial http://docs.appthemes.com/tutorials/...o-google-maps/ which is fantastic, but I needed the form to work when a user hits enter, not just when clicking the button. Thought I'd share in case anyone else needs this...

    In scripts.js where this code is placed:
    Code:
    jQuery('#get_directions').click( function(){
    var start = jQuery('#directions_from').val();
    add the following code above it so it looks like this:
    Code:
    jQuery('#directions_from').keydown(function(event){    
    if(event.keyCode==13){
       jQuery('#get_directions').trigger('click');
    	}
    });
    
    jQuery('#get_directions').click( function(){
    var start = jQuery('#directions_from').val();

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problem with Adding Google Driving Directions Service to Google Maps
    By danyz in forum Vantage General Discussion (Legacy)
    Replies: 10
    Last Post: December 1st, 2012, 02:04 PM
  2. Google Maps Driving Directions issue
    By korrigan in forum Vantage General Discussion (Legacy)
    Replies: 0
    Last Post: November 29th, 2012, 12:06 AM
  3. Google Map to show directions & info
    By thomas_abney in forum Vantage General Discussion (Legacy)
    Replies: 1
    Last Post: June 18th, 2012, 10:24 PM
  4. Directions for Place Listing from Google Map Widget
    By kalel27 in forum Vantage General Discussion (Legacy)
    Replies: 1
    Last Post: May 24th, 2012, 12:33 AM
  5. [MOD NEEDED] Need to put directions in google maps
    By precocerto in forum ClassiPress General Discussion
    Replies: 1
    Last Post: November 3rd, 2011, 09:16 PM