我想添加一個SVG的外部對象,但它沒有顯示。它被添加到SVG中。爲什麼會發生這種情況,我該如何解決?我的元素foreignObject不顯示
body = d3.select('body')
svg = body.append('svg').attr('height', 600).attr('width', 600)
var div= svg.append('foreignObject')
.attr("width",50)
.attr('height',50)
.append("div")
.attr("class", "tooltip")
.style("opacity", 1);
div.append('img')
.attr("id", "img_tweet").attr("src", "")
.attr("class", "imagen_tweet");
div.append('div').attr("id", "texto_tweet");
document.getElementById('img_tweet').src="https://www.amrita.edu/sites/default/files/news-images/new/news-events/images/l-nov/grass.jpg";
document.getElementById('texto_tweet').innerHTML='message'
https://jsfiddle.net/tzp3oe5a/
jsfiddle中的html元素在哪裏?我看到只有一個js – vaso123
@ vaso123我使用d3.js,這個動態創建元素 – yavg