fork download
  1. //выставление геолокации при клике на карту
  2. map.addListener('click', function(e) {
  3. const marker = new google.maps.Marker({
  4. map: map,
  5. position: e.latLng,
  6. draggable: true,
  7. });
  8. const contentString = `
  9. <div id="content">
  10. <div id="siteNotice"></div>
  11. <div id="bodyContent">
  12. <input type="text" class="location_name" placeholder="Введите название" >
  13. </div>
  14. </div>`;
  15. const infowindow = new google.maps.InfoWindow({
  16. content: contentString,
  17. });
  18. infowindow.open(map, marker);
  19. google.maps.event.addListener(infowindow, 'closeclick', function (){
  20. const content = $(this.content);
  21. console.log(content.find('.location_name').val());
  22. })
  23. marker.addListener("click", () => {
  24. infowindow.open(map, marker);
  25. });
  26. });
Runtime error #stdin #stdout #stderr 0.03s 16668KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.js:2:1 ReferenceError: map is not defined
Stack:
  @prog.js:2:1