Your div element in a document has id="answers". If a js fn sets d=document.Getelementbyid("answers"), then which is the preferred way to add a paragraph containing the word "hello" as a child of that div?
Answers
Answered by
1
Answer:
4. p = createElement("p"); p.innerHTML = "Hello"; d.appendChild(p);
Explanation:
Your div element in a document has id="answers". If a js fn sets d=document.Getelementbyid("answers"), then which is the preferred way to add a paragraph containing the word "hello" as a child of that div?
Missing options in the question:-
1. answers.innerHTML = "Hello";
2. d.innerHTML = "Hello ";
3. d.appendChild("Hello ");
4. p = createElement("p"); p.innerHTML = "Hello"; d.appendChild(p);
Correct Answer :- p = createElement("p"); p.innerHTML = "Hello"; d.appendChild(p);
Answered by
0
Answer:
p = createElement("p"); p.innerHTML = "Hello"; d.appendChild(p);
Explanation:
Similar questions