So basically, i have checked that no error occurs in the console and the element tab in the dvelopper tools. I am just starting off with d3 (really beginner), but it feels like everything is fine with my code.
var h = 1000
var w = 1000
var svg = d3.select("body")
.append("svg")
.attr("height", h)
.attr("width", w)
var rect_ = svg.append("rect")
.attr("x", 100)
.attr("y", 100)
.attr("class", "rect_class")
.attr("height", 100)
.attr("width", 100)
d3.selectAll(".rect_class")
.append("text")
.style("stroke", "green")
.attr("x", function(d){
return d3.select(this.parentNode).attr("x")
})
.attr("y", function(d){
return d3.select(this.parentNode).attr("y")
})
.text("text 1")