Skip to content

Tag: createtextnode

Javascrit .createTextNode output is giving errors

I created a website where it tells you your age. I use document.createTextNode to store the output but the output is not working properly. Here is the output code When I run my code, it only outputs the first part, “You are”. Is there any way to output the entire message. Answer In JavaScript you use + instead of .

TextNode or textContent?

What’s the advantage of creating a TextNode and appending it to an HTML element over setting directly its textContent? Let’s say I have a span. And I want to change its text. What’s the advantage of using : over span.textContent = ‘hello’; Answer It ‘s not really matter of advantage but of proper usage depending on the need. The fundamental