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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:34:24+00:00 2026-06-16T07:34:24+00:00

Hello everyone I am building a website and it has a checkbox if that

  • 0

Hello everyone I am building a website and it has a checkbox if that box is checked it would display google map and if not it will hide it. When I load it without .hide() and .show() it works correctly but when I use hide() and show() methods it would load a portion of the map.

The code

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=MYKEY&sensor=false"></script>
<script>
 var MAPID = "map";

 function initialize(){
 var loc     = new google.maps.LatLng(23.70656905403075,-53.58581517968753);
 var options = {
 zoom      : 8,
 center    : loc,
 mapTypeId : google.maps.MapTypeId.ROADMAP
};

var map     = new google.maps.Map(document.getElementById(MAPID),options);
var marker  = new google.maps.Marker({
 position  : loc,
 map       : map,
 draggable : true,
 animation : google.maps.Animation.DROP,
title     : "Hello world"
});
google.maps.event.addListener(marker,"dragend",function(e){
updateloc(this.position);
});

marker.setMap(map);
}

function updateloc(loc){
$("#lat").val(loc.lat());
$("#long").val(loc.lng());
}
$(document).ready(function(){
            $("#map_canvas").hide();
            $("#lat").hide();
            $("#long").hide();
            $("#theMap").change(function(){
                    if(this.checked)
                    $("#map_canvas").show();
                    else
                    $("#map_canvas").hide();
                    }); 
            }); 



</script>
</head>
<body onload="initialize();" >
<form>
<input type="checkbox" id="theMap">
<div id="map" style="width:400px;height:400px"></div>
<input id="lat" />
<input id="long" />
</form>
</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-06-16T07:34:26+00:00Added an answer on June 16, 2026 at 7:34 am

    I found someone with a similar problem http://www.csie.nctu.edu.tw/~wctang/mapv3test.html
    and I did the google.maps.event.trigger(map,'resize'); and it fixed the problem.

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

Sidebar

Related Questions

Hello everyone please guide whats wrong with this code that image is not visible
Hello everyone I have a checkbox I want to check if its checked or
Hello everyone I'm having some problems when a calling an iframe that has an
hello everyone I am trying to make a script that steps through a list
Hello everyone don't know why this code works on windows but not on linux
Hello everyone it's been some days that I use sql to make analysis and
Hello everyone, I am using hibernate ORM and oracle database. My cfg file has
hello everyone i have multiple dynamic edittext box.i want to give width to fill
Hello everyone I've never had a problem which i cant solve with google... So
Hello everyone! I have a website which is http://www.urbanelementz.ca ... It's currently in development.

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.