我想问为什么在目标div中创建了一些div,我使用openlayers 3和我的代码:
var _showMousePositioning = function () {
/* mouse positioning */
this._mousePositionControl = new ol.control.MousePosition({
coordinateFormat: function (coordinate) {
return ol.coordinate.format(coordinate, '{y} / {x}', 4);
},
projection: 'EPSG:4326',
// comment the following two lines to have the mouse position
// be placed within the map.
className: 'custom-mouse-position',
target: document.getElementById('mouse-position'),
undefinedHTML: ' '
});
this._olMap.addControl(this._mousePositionControl);
$('.custom-mouse-position:nth-child(1)').hide();
}
结果:
<div id ="mouse-position">
<div class="custom-mouse-position"> </div>
<div class="custom-mouse-position"> </div>
<div class="custom-mouse-position"> </div>
</div>
有时它创建2或3 div ...鼠标定位在最后div的值。如何删除包含空格的另一个div。有什么方法可以删除另一个div?感谢