I am attempting to dynamically add additional text to an HTML document. I have successfully retrieved the text, but it is not being displayed within an h3 element. Any thoughts on what might be causing this issue?
let brElement = document.createElement("br");
let pickCategory = document.createElement("div");
let h3Element = document.createElement("h3");
let newPick = document.createTextNode("Choose a vehicle category: ");
document.body.appendChild(pickCategory.appendChild(brElement.appendChild(h3Element.appendChild(newPick))));
The output consists of a new div and new line displaying the desired text, however, it is not within the expected h3 element. Why could this be happening?!