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

  • SEARCH
  • Home
  • 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 7620117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:51:38+00:00 2026-05-31T03:51:38+00:00

Im using jQuery to modify html that has been created with other javascript. If

  • 0

Im using jQuery to modify html that has been created with other javascript. If I make the jQuery run when I click a button everything works fine.

However if I run the jQuery on window load it doesn’t do anything. By adding an alert it seems its run before the other javascript has finished created html on the page. How can I make my jQuery run after all other javascript has finished?

Note – im making a demo only, so performance and best practice aren’t really an issue in this case. Thanks

UPDATE – here is my code:

<html>    
  <head> 
    <script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script>        
    <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
    <script type="text/javascript" src="../gmap3.js"></script> 
    <style>
        body, html {
            margin: 0;
            padding: 0;
        }
      .gmap3{
        margin: 20px auto;
        border: 1px dashed #C0C0C0;
        width: 320px;
        height: 450px;
      }
      #panTo{
        background-color: Pink;
        float: left;
        text-align: left;
        width: 200px;
      }
      .find {
        height: 10px;
        width: 10px;
        background-color: grey;
      }
      #start {
        position: absolute;
        top: 0;
        right: 0;
      }
      #button-0 {
        display: none;
      }
      .two {
        background-color: white;
        display: none;
        white-space: nowrap;
        z-index: 999999;
        position: relative;
        right: -19px;
        top: -46px;
        padding: 5px;
        border: 1px solid black;
        border-radius: 10px;
      }
      .no {
        text-align: center;
        border:1px solid grey; 
        position: relative; 
        left: -22px; 
        top: -2px; 
        background-color: white; 
        width: 19px; 
        height: 32px;
      }
      .active {
        font-weight: bold;
      }
    </style>

    <script type="text/javascript">

      $(function(){
      var points = [
            [54.618017, 3.48291],
            [53.618017, 2.78291],
            [52.618017, 2.48291],
            [51.618017, 2.28291],
            [50.618017, 1.88291],
            [50.218017, 1.48291],
            [50.118017, 0.439453]
        ];



        $('#test1').gmap3(
          { action: 'init',
            center:{
                lat:44.797916, 
                lng:-93.278046
            },
            onces: {
              bounds_changed: function(){
                $(this).gmap3({
                  action:'getBounds', 
                  callback: function (bounds){
                    if (!bounds) return;
                    var southWest = bounds.getSouthWest(),
                        northEast = bounds.getNorthEast(),
                        lngSpan = northEast.lng() - southWest.lng(),
                        latSpan = northEast.lat() - southWest.lat(),
                        i;
                    for (i = 1; i < 4; i++) {
                     // add($(this), i, southWest.lat() + latSpan * Math.random(), southWest.lng() + lngSpan * Math.random());
                      add($(this), i, points[i][0], points[i][1]);
                    }
                  }
                });
              }
            }
          }
        );

      });

      function add($this, i, lat, lng){
        $this.gmap3(
        { action: 'addMarker',
          latLng: [lat, lng],
          callback: function(marker){
            var $button = $('<span id="button-'+i+'"> ['+i+'] </span>');
            $button
              .click(function(){    
                  $this.gmap3({
                    action:'panTo', 
                    args:[marker.position]
                  });
              })
              .css('cursor','pointer');
            $('#panTo').append($button);
          }
        },
        { action:'addOverlay',
          latLng: [lat, lng],
          options:{
            content: '<div class="no no-'+i+'" >'+i+'<div class="two"></div></div>',
            offset:{
              y:-32,
              x:12
            }


          },

          events:{
            mouseover: function(overlay){
           //   $(overlay.getDOMElement()).children().css('backgroundColor', '#0000FF');
            },
            mouseout: function(overlay){
           //   $(overlay.getDOMElement()).children().css('backgroundColor', '#00FF00');
            }
          }








        });
      }







      $(document).ready(function() {
      //$('#start').live("click", function() {
      //  $(window).load(function () {




                $('#button-1').html('<p>1) Herne Hill</p>');
                $('#button-2').html('<p>2) Sloane Square</p>');
                $('#button-3').html('<p>3) Elephant and Castle</p>'); 

                $('.no-1 .two').text('Herne Hill');
                $('.no-2 .two').text('Sloane Square');
                $('.no-3 .two').text('Elephant and Castle');



            $('#button-1').live("click", function() {
                $('.two').css('display','none');
                $('.no-1 .two').css('display','inline-block');
                $('#panTo span').removeClass('active');
                $(this).addClass('active');
            });

            $('#button-2').live("click", function() {
                $('.two').css('display','none');
                $('.no-2 .two').css('display','inline-block');
                $('#panTo span').removeClass('active');
                $(this).addClass('active');
            });

            $('#button-3').live("click", function() {
                $('.two').css('display','none');
                $('.no-3 .two').css('display','inline-block');
                $('#panTo span').removeClass('active');
                $(this).addClass('active');
            });



            $('.no-1').live("click", function() {
                $('.two').css('display','none');
                $('.no-1 .two').css('display','inline-block');
                $('#panTo span').removeClass('active');
                $('#button-1').addClass('active');
            });

            $('.no-2').live("click", function() {
                $('.two').css('display','none');
                $('.no-2 .two').css('display','inline-block');
                $('#panTo span').removeClass('active');
                $('#button-2').addClass('active');
            });

            $('.no-3').live("click", function() {
                $('.two').css('display','none');
                $('.no-3 .two').css('display','inline-block');
                $('#panTo span').removeClass('active');
                $('#button-3').addClass('active');
            });



        });


    </script>  

    <meta name="viewport" content="width=device-width">

  </head>

  <body>

    <div id="start">start</div>

    <div id="panTo"></div>
    <div id="test1" class="gmap3"></div>
  </body>
</html>
  • 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-31T03:51:40+00:00Added an answer on May 31, 2026 at 3:51 am

    You may also delay the execution of your script to make sure other libraries have completed their initialization.

    Eg:

    $(function(){
    
       setTimeout(function(){
         //your code in this block is executed after 500 ms
    
       }, 500);
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I've been working on a web application that is using JQuery to parse
Using jQuery, how do you bind a click event to a table cell (below,
Using jQuery, is there a way to select all tag that reference a specific
I'm using some embed codes that insert HTML to the page dynamically and since
I have a bunch of HTML that is generated by a daemon using C,
I am building an order form using HTML and jQuery and it is complete,
I'm using node-jquery , and I'd like to use it to modify an existing
Is it possible to use jQuery to modify HTML plaintext? For example, in this
I'm using jquery + the accordion plugin. That's working great. Now, I want another
I have registration form on my website that, using jquery I append default values

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.