Gian Franco Alexis Poma Vidal Asked: 2020-03-06 13:06:46 +0800 CST 2020-03-06 13:06:46 +0800 CST 2020-03-06 13:06:46 +0800 CST Uncaught TypeError: container_panel.textContent is not a function 772 Why do I get that error? What am I doing wrong: const contenedor_panel = document.createElement("div") contenedor_panel.textContent("xd") javascript 2 Answers Voted Best Answer alanfcm 2020-03-06T13:13:39+08:002020-03-06T13:13:39+08:00 The problem is that textContentit's not a function, it's a property, you need to match the property to the text you want. Something like that: var contenedor_panel = document.createElement("div") contenedor_panel.textContent = "xd" document.body.appendChild(contenedor_panel) Gian Franco Alexis Poma Vidal 2020-03-06T13:19:13+08:002020-03-06T13:19:13+08:00 the problem was that the value was not passed by parentheses, but by equals. const contenedor_panel = document.createElement("div") contenedor_panel.textContent = "xd"
The problem is that
textContent
it's not a function, it's a property, you need to match the property to the text you want. Something like that:the problem was that the value was not passed by parentheses, but by equals.