Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9229199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:30:46+00:00 2026-06-18T05:30:46+00:00

I have a form that is dynamically inserted into the Google Map. However I

  • 0

I have a form that is dynamically inserted into the Google Map. However I cannot click any of the inputs. I believe I need to add a listener somewhere but I’m not sure.

Fiddle

    function googlemap() {

    // google map coordinates
    var posY = 37.765700,
        posX = -122.449134,
        location = new google.maps.LatLng(posY,posX),

        // offset location
        posY = posY + 0.055;
        offsetlocation = new google.maps.LatLng(posY,posX);

    var mapOptions = {
        panControl: false,
        zoomControl: false,
        mapTypeControl: false,
        scaleControl: false,
        streetViewControl: false,
        overviewMapControl: false,
        draggable: true,
        disableDoubleClickZoom: false,
        scrollwheel: false,
        zoom: 12,
        center: offsetlocation,
        // ROADMAP; SATELLITE; HYBRID; TERRAIN;
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    overlay.prototype = new google.maps.OverlayView();

    // create overlay marker
    overlay.prototype.onAdd = function() {

        blip = document.createElement('div'),
        pulse = document.createElement('div');
        blip.className = 'blip';
        pulse.className = 'pulse';

        // createa dialog and grab contents from #mapcontents
        boxText = document.createElement("div");
        boxText.className = "dialog";
        mapContents = $('#mapcontents').html();
        boxText.innerHTML = mapContents;
        $('#mapcontents').remove();
        blip.appendChild(boxText);

        // append 'blip' marker
        this.getPanes().overlayLayer.appendChild(blip).appendChild(pulse);
    }

    // update blip positioning when zoomed
    overlay.prototype.draw = function(){

        var overlayProjection = this.getProjection(),
            bounds = new google.maps.LatLngBounds(location, location),
            sw = overlayProjection.fromLatLngToDivPixel(bounds.getSouthWest()),
            ne = overlayProjection.fromLatLngToDivPixel(bounds.getNorthEast());

        blip.style.left = sw.x + 'px';
        blip.style.top = ne.y + 'px';



        // shift nav into view by resizing header
        var w = $('.dialog').width(),
            w = (w / 2) + 25,
            w = '-' + w + 'px';

            h = $('.dialog').height(),
            h = (h) + 100,
            h = '-' + h + 'px';

        $('.dialog').css({
            'margin-top' : h,
            'margin-left' : w
        });


    };

    var map = new google.maps.Map(document.getElementsByClassName('map')[0], mapOptions);

    // explicitly call setMap on this overlay
    function overlay(map) {
        this.setMap(map);
    }

    // center map when window resizes
    google.maps.event.addDomListener(window, 'resize', function() { map.setCenter(location) });

    // center map when zoomed
    google.maps.event.addListener(map, 'zoom_changed', function() { map.setCenter(location) });

    // I have nfi what I'm doing but I think this click listener is part of the solution.
    google.maps.event.addListener('.dialog', 'click', function() {

        alert('ok');
    });

    // process contact form
    google.maps.event.addListener(map, 'domready', function() {

        $('button').click(function(e) {
            (e).preventDefault();

            alert('ok');

            return false;

            var name    = $(".contactform input[name='name']"),
                email   = $(".contactform input[name='email']"),
                message = $(".contactform textarea[name='message']"),
                error = false;

            // clear validation errors
            $('#contact input, #contact textarea').removeClass('error');

            if(name.val().length < 1)
                name.addClass("error");

            if(!/^[a-zA-Z0-9._+-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,4}(\.[a-zA-Z]{2,3})?(\.[a-zA-Z]{2,3})?$/.test(email.val()))
                email.addClass("error");

            if(message.val().length < 1)
                message.addClass("error");

            // if error class exists
            if($(".error").length) return false;

            $(this).attr('disabled', true).prepend('<i class="load animate-spin"></i>');

            $.ajax({
                type: "post",
                dataType: "json",
                url: "lib/sendmail.php",
                data: $("#contactform").serialize()
            })
            .always(function(data) {

                $('h5').animate({opacity:0},function(){
                        $('h5').text("Email Sent!!")
                    .animate({opacity:1});
                });

                $('.contactform').animate({opacity:0},function(){
                        $('.contactform').html("<p class='success'>Thank You for your form submission. We will respond as soon as possible.</p>")
                    .animate({opacity:1});
                })

            });

        });

        return false;
    });


    // add overlay
    overlay = new overlay(map);
}

Any idea why I can’t click the inputs?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:30:47+00:00Added an answer on June 18, 2026 at 5:30 am

    You just need to block propagation of mousedown map event to make inputs clickable:

    google.maps.event.addDomListener(blip, 'mousedown', function (e) {
        e.cancelBubble = true;
        if(e.stopPropogation) {
            e.stopPropagation();
        }
    });
    

    And you can do the same for dbclick to prevent map zooming: http://jsfiddle.net/gfKWz/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Greasemonkey script that dynamically inserts an HTML form into some web
I have a form that dynamically generates elements in groups, so I cannot be
I have a form that allows you to preview coordinates via a google map.
I have a form that is dynamically created, on this form are several radio
I have a dynamic form that allow to add many fields dynamically, I Know
I have a Winforms application that dynamically instantiates external form objects for use in
I have several radio buttons that are dynamically populated on a form and I
Fact: I'm not that good with jQuery. Problem: I have a form containing dynamically
i have a form that is dynamically built. so the number of form elements
I have a form that can be dynamically duplicated (with JS) so that the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.