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 3279966
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:39:06+00:00 2026-05-17T19:39:06+00:00

I have a page that loads content via ajax. When I click on a

  • 0

I have a page that loads content via ajax. When I click on a list item it shows a detail view of that item via ajax. In the details i have a lightbox that opens up if a link is clicked. I’m using Colorbox for that.

What boggles me is that if I use $(selector).click() it won’t work, nor the $(selector).bind() either. The only way a click can be captured and trigger the Colorbox is if I use the $(selector).live() feature of jQuery.

But by using it, I need to click on the link twice to get the colorbox to activate.

This is what I have:

$('#details #map-work').live('click', function(){
                var name  = $('#dFname').text();
                ///////////////////////////////////////////////////////////////////
                ////////// Google Maps API Functions //////////////////////////////
                $(this).bind('cbox_complete', function(){
                    var geocoder;
                    var map;
                    var a = $("span#co_address").text() + $("span#co_city").text() + $("span#co_state").text() + $("span#co_zip").text();
                    //var image = 'http://code.google.com/apis/maps/documentation/javascript/examples/images/beachflag.png';
                    geocoder = new google.maps.Geocoder();
                    var latlng = new google.maps.LatLng(-34.397, 150.644);
                    var myOptions = {
                        zoom: 19,
                        center: latlng,
                        disableDefaultUI: true,
                        mapTypeId: google.maps.MapTypeId.HYBRID
                    }
                    map = new google.maps.Map(document.getElementById("map"), myOptions);

                    geocoder.geocode( { 'address': a}, function(results, status) {
                        if (status == google.maps.GeocoderStatus.OK) {
                            map.setCenter(results[0].geometry.location);
                            var infowindow = new google.maps.InfoWindow({
                                content: a
                            });
                            var marker = new google.maps.Marker({
                                map: map,
                                //draggable: true,
                                //icon: image,
                                position: results[0].geometry.location
                            });
                            google.maps.event.addListener(marker, 'click', function() {
                                infowindow.open(map, this);
                            });
                            infowindow.open(map, marker);
                        } else {
                            console.log("Geocode was not successful for the following reason: " + status);
                        }
                    });
                });
                ///////////////////////////////////////////////////////////////////
                $(this).colorbox({width:"650", inline:true, href:"#map", overlayClose: false});
                //$('#colorbox').draggable();
                return false
            });

I have been trying to see if I can load this script once the detail view is activated maybe then I can use the click() or bind() instead of live() but that still doesn’t work with my scenario or perhaps I just don’t understand this very well and don’t know something this simple.

  • 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-05-17T19:39:07+00:00Added an answer on May 17, 2026 at 7:39 pm

    It’s a bit difficult to guess the exact problem without a demo page, but you could try this version of your code:

    $('#details #map-work')
      .live('cbox_complete', function(){
                        var geocoder;
                        var map;
                        var a = $("span#co_address").text() + $("span#co_city").text() + $("span#co_state").text() + $("span#co_zip").text();
                        //var image = 'http://code.google.com/apis/maps/documentation/javascript/examples/images/beachflag.png';
                        geocoder = new google.maps.Geocoder();
                        var latlng = new google.maps.LatLng(-34.397, 150.644);
                        var myOptions = {
                            zoom: 19,
                            center: latlng,
                            disableDefaultUI: true,
                            mapTypeId: google.maps.MapTypeId.HYBRID
                        }
                        map = new google.maps.Map(document.getElementById("map"), myOptions);
    
                        geocoder.geocode( { 'address': a}, function(results, status) {
                            if (status == google.maps.GeocoderStatus.OK) {
                                map.setCenter(results[0].geometry.location);
                                var infowindow = new google.maps.InfoWindow({
                                    content: a
                                });
                                var marker = new google.maps.Marker({
                                    map: map,
                                    //draggable: true,
                                    //icon: image,
                                    position: results[0].geometry.location
                                });
                                google.maps.event.addListener(marker, 'click', function() {
                                    infowindow.open(map, this);
                                });
                                infowindow.open(map, marker);
                            } else {
                                console.log("Geocode was not successful for the following reason: " + status);
                            }
                        });
                    }
      )
      .live('click', function(){
                    ///////////////////////////////////////////////////////////////////
                    ////////// Google Maps API Functions //////////////////////////////
                    ///////////////////////////////////////////////////////////////////
                    $(this).colorbox({width:"650", inline:true, open: true, href:"#map", overlayClose: false});
                    //$('#colorbox').draggable();
                    return false
                });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page on my site that currently loads html via ajax. The
I have a page that loads a div via AJAX. The AJAX POST call
I have multiple divs in a page whose content gets loaded via ajax. I
I have some content on my page that I require to be loaded via
I have a ChildUserControl that is loaded inside a ParentUserControl. The host page loads
I have a page that is generated which inserts an HTML comment near the
I have a page that uses $(id).show(highlight, {}, 2000); to highlight an element when
I have a page that has an iframe From one of the pages within
I have a page that is hitting a webservice every 5 seconds to update
I have a page that is supposed to launch the Print Preview page onload.

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.