简体   繁体   中英

Removing title tag attribute from google map

在此处输入图片说明

I want to completely remove the title tag when the user mouseovers on the marker. This is what I have tried so far.

jQuery("[title]").removeAttr("title");
jQuery("*").removeAttr("title");

Neither works.

I have referred to the below solutions also.

removing default mouseover tooltip from marker in google-maps

title of a marker of google map marker API

But could not find any solution that actually removes the title tag.

I have updated the script set properties: title: ''.

Updated and it worked: http://jsfiddle.net/edf3gwuk/

 var infowindow = new google.maps.InfoWindow(); function point(lat, long) { var self = this; self.name = name; var marker = new google.maps.Marker({ position: new google.maps.LatLng(lat, long), title: '', map: map, draggable: true }); google.maps.event.addListener(marker, 'mouseover', function (e) { e.mb.target.removeAttribute('title') //infowindow.setContent(marker.title); //infowindow.open(map, marker); }.bind(this)); google.maps.event.addListener(marker, 'mouseout', function () { infowindow.close(); }.bind(this)); } var map = new google.maps.Map(document.getElementById('googleMap'), { zoom: 5, center: new google.maps.LatLng(55, 11), mapTypeId: google.maps.MapTypeId.ROADMAP }); new point(58, 14); 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maps.googleapis.com/maps/api/js?key=&sensor=false"></script> <section id="Map"> <div id="googleMap" style="width:350px;height:600px;"></div> </section> 

my solution is set to the content of the label is empty

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM