1
我想將彈出數據添加到我製作的特定div tab4
。我在我的問題中發佈了代碼。這是我迄今爲止所擁有的。如果我console.log(d.html)
我得到正確的輸出,但它不顯示在我的div。我想我錯過了一些東西綁定或推到tab4
股利,但我不知道。將小冊子彈出信息添加到特定div
window["mapDataLayer"] = L.geoJson(geojson, {
onEachFeature: function (feature, layer){
layer.on({
click: function showResultsInDiv() {
var d = document.getElementById('tab4');
d.html = "";
for (prop in feature.properties){
d.html += prop+": "+feature.properties[prop]+"<br>";
}
console.log(d.html);
// I Think i need a line of code here that pushes it to the 'tab4' div.
}
}); }
}).addTo(map);