JSFiddle - React, Tailwind, and code Playground
HTML
<div id="allMyParas" style="border-top: 1px #000 solid;">
<p id="firstParagraph">This is my first paragraph.</p>
<p id="secondParagraph">This is my second paragraph.</p>
</div>
JavaScript
var parasDiv = document.getElementById("allMyParas");
var thirdPara = document.createElement("p");
thirdPara.setAttribute("id", "thirdParagraph");
parasDiv.appendChild(thirdPara);
thirdPara.innerHTML = "This is my third paragraph.";
parasDiv.style.borderBottom = "1px #000 solid";
var parasInDiv = parasDiv.getElementsByTagName("p");
for (var i = 0; i < parasInDiv.length; i++) {
parasInDiv[i].style.backgroundColor = "lightgrey";
}