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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:37:27+00:00 2026-06-15T23:37:27+00:00

i have a div which i fill dynamically with the .load() method. I have

  • 0

i have a div which i fill dynamically with the .load() method.
I have a function to display a google map in this div on a click of a link in my menu.

function ShowGmap() {
  var myLatlng = new google.maps.LatLng(41.905, 12.710);
    var mapOptions = {
      center: myLatlng,
      zoom: 16,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("mb"),
        mapOptions);
    var marker = new google.maps.Marker({
  position: myLatlng,
  map: map,
  title:"----"

mb is the ID of the div I fill everytime. What i want is that each button on my menu will fill this div with different content.
The problem is: when I click on a second button to change the content of that div, the map flash( sometimes it keep beeing drawed on the div like a background ) for a second. I am not sure if this is a cache problem.
This is the code for the click action on the home button

$("#bt_home").click(function(){
    event.preventDefault();
    click_btdove=false; //this make the button clickable only once
     $("#mb").removeAttr('style');
     $('#mb').load('main_page.html #home');

the removeAttr is needed because the div has a grey background after the loading of the map (checked with ‘inspect element’ on chrome.

Thanks for the help.

edit:
this is a pic of what i mean: img of the problem

edit #2 this is my project: check out what happened when u click on ” dove siamo ” button

  • 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-15T23:37:27+00:00Added an answer on June 15, 2026 at 11:37 pm

    try with this one:

     $("#bt_home").click(function(event){
         event.preventDefault();
         click_btdove=false; //this make the button clickable only once
         $("#mb").css({"background":"none"}); // <-----add this to remove the background color
         $('#mb').load('main_page.html #home');
     });
    

    As i see your code tries to prevent the default behavior of the link but you have not passed that in the function.

    see this if helps.

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

Sidebar

Related Questions

I have a DIV which I want to be removed when I click a
I have a div which I have attached an onclick event to. in this
I have a page with two div s on it which should fill the
i have a div with a table object which fill in onload event of
I have a div which needs to fill out the height of the browser's
I have a fixed size div which I need to fill with text. I
I have some data coming from the server in which I fill A Div
I have div which has three buttons as, <div id=buttons> <input id=preview class=ButtonStyle type=submit
I have DIV element which only has a few lines in and a background
I have div class=contentBlock which is treated as the container for updating <div class=contentBlock></div>

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.