My map is not displayed

0

I'm making a page in html, the question that does not show me the google map. I used to do it before but not anymore. I modified everything thinking if it had an error but igue without showing it. Notes: I use my google API

                                                   

Contact Us!

                                              
    <!--Form-->
    <div class="row">
        <div class="col-md-6">
            <form class="form-horizontal" method="post" action="sendEmail.php">
                <div class="form-group">
                  <label for="name"><span><i class="fa fa-user"></i></span> Enter Name</label>
                  <input id="fname" name="name" type="text" placeholder="Name" class="form-control" required>
                </div>

                <div class="form-group">
                  <label for="email"><span><i class="fas fa-at"></i></span> Enter Email</label>
                  <input id="email" name="email" type="text" placeholder="Email Address" class="form-control" required>
                </div>

                <div class="form-group">
                  <label for="subject"><span><i class="far fa-comment-alt"></i></span> Subject</label>
                  <input id="subject" name="subject" type="text" placeholder="Subject" class="form-control" required>
                </div>

                <div class="form-group">
                  <label for="message"><span><i class="fas fa-edit"></i></span> Enter Message</label>
                  <textarea class="form-control" id="message" name="message" placeholder="Enter your message for us here." rows="4" required></textarea>
                </div>

                <div class="form-check mb-1">
                    <label class="form-check-label" for="checkAgree">
                      <input type="checkbox" name="checkAgree" id="checkAgree" class="form-check-input mr-2" required>I accept terms and conditions
                    </label>
                </div>
                <button type="submit" class="btn btn-primary btn-block">Send Email</button>
            </form>
        </div>  

          <!--Google map-->
        <div class="map col-md-6">
          <div class="map" id="map"></div>
        </div>
    </div>
  </div>
</section>
    
asked by Daniel T 25.10.2018 в 20:55
source

1 answer

0
<script>
    function myMap() {
    var mapProp= {
        center:new google.maps.LatLng(51.508742,-0.120850),
        zoom:5,
    };
    var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
    }
    </script>

    <script src="https://maps.googleapis.com/maps/api/js?key=TU_LLAVEAPI&callback=myMap"></script>

<div class="row">
        <div class="col-md-6">
            <form class="form-horizontal" method="post" action="sendEmail.php">
                <div class="form-group">
                  <label for="name"><span><i class="fa fa-user"></i></span> Enter Name</label>
                  <input id="fname" name="name" type="text" placeholder="Name" class="form-control" required>
                </div>

                <div class="form-group">
                  <label for="email"><span><i class="fas fa-at"></i></span> Enter Email</label>
                  <input id="email" name="email" type="text" placeholder="Email Address" class="form-control" required>
                </div>

                <div class="form-group">
                  <label for="subject"><span><i class="far fa-comment-alt"></i></span> Subject</label>
                  <input id="subject" name="subject" type="text" placeholder="Subject" class="form-control" required>
                </div>

                <div class="form-group">
                  <label for="message"><span><i class="fas fa-edit"></i></span> Enter Message</label>
                  <textarea class="form-control" id="message" name="message" placeholder="Enter your message for us here." rows="4" required></textarea>
                </div>

                <div class="form-check mb-1">
                    <label class="form-check-label" for="checkAgree">
                      <input type="checkbox" name="checkAgree" id="checkAgree" class="form-check-input mr-2" required>I accept terms and conditions
                    </label>
                </div>
                <button type="submit" class="btn btn-primary btn-block">Send Email</button>
            </form>
        </div>  

          <!--Google map-->
        <div class="map col-md-6">
          <div id="googleMap" style="width:100%;height:400px;"></div>
        </div>
    </div>
  </div>
</section>

Try the following, check well that your script if you are calling the correct way on your div.

    
answered by 25.10.2018 в 21:10