Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to open popup on click of a marker from the directions service?
    primarykey
    data
    text
    <p><strong>UPDATE</strong><br> when i click green marker,it's display address of location.can i change it?</p> <p><strong>LATER EDIT :</strong><br> is it possible to open popup on click of a marker from the directions service?<br> or try the other way like only hide a marker from the directions service(green marker) and display only red marker(hide only green marker not it's route)?is it good way? </p> <p><strong>if not possible, please suggest some alternative ideas.</strong></p> <p><strong>OLDER:</strong> </p> <p>i have a two types of marker on google map.the red marker is normal marker which represent location.and green marker is route marker(its represent many of waypoints of the map).<br> I modify the infowindow with textbox.which is open on click red marker. </p> <p>actually i am trying to do is, first i place multiple markers on google map then i draw route between this markers.this thing is done.reminder thing is on click green marker one popup is opened in which user enter price and then click the button.then i got this value and store it to database.<br> the problem is:</p> <p>(1) how to open same infowindow on click of green marker?<br> in short,how to write a code for display infowindow on click of of green marker.<br> how to find click event of green marker? </p> <p><img src="https://i.stack.imgur.com/SW5sg.png" alt="enter image description here"> </p> <p><img src="https://i.stack.imgur.com/GFF9O.png" alt="enter image description here"></p> <p><code>code is:</code></p> <pre><code> &lt;script type="text/javascript"&gt; var markerarray=new Array(); //for way points var waypts=[]; //array in json format for placing multiple marker var locations = &lt;?php echo json_encode($lat1);?&gt;; var map = new google.maps.Map(document.getElementById('map'), { zoom: 11, center: new google.maps.LatLng(23.0171240, 72.5330533), mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); &lt;!-- ************* for placing markers ************ --&gt; var marker, i; for (i = 0; i &lt; locations.length; i++) { marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i][3], locations[i][4]), map: map //enable if you want marker }); //push value into way points waypts.push({ location:locations[i][0], stopover:true }); //create array for polyline markerarray[i] = marker.getPosition();//(Array(locations[i][5], locations[i][6])); google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { var data='&lt;div style="height:150px !important"&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;Enter Price&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;input type="text" name="prc" id="prc" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;'; infowindow.setContent(data); infowindow.open(map, marker); } })(marker, i)); } &lt;!-- ************** for route between markers ******************* --&gt; var first=locations[locations.length-1][0]; var directionsDisplay; var directionsService = new google.maps.DirectionsService(); //directionsDisplay = new google.maps.DirectionsRenderer(); directionsDisplay = new google.maps.DirectionsRenderer({ polylineOptions: { strokeColor: 'red',//"black", strokeOpacity: 1.0, strokeWeight: 3 } }); var start = locations[0][0];//"Bopal, Ahmedabad, Gujarat, India"; var end = locations[locations.length-1][0];//"Nikol, Ahmedabad, Gujarat, India"; //remove start destination from array waypts.shift(); //remove end destination from array waypts.pop(); var request = { origin:start, destination:end, waypoints:waypts, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } }); directionsDisplay.setMap(map); &lt;/script&gt; </code></pre> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload