I have the following script inside html, but the output inside html is without style.
How can I best style the script output so as it fits within the existing html structure?
I thought this may be achieved by getting the output by id, but have not figured that out.
<script>
var myArray = [
"<ul><p>Alef</p><p>1</p>",
"<ul><p>Bet</p><p>2</p>"
];
var randomItem = myArray[Math.floor(Math.random()*myArray.length)];
document.body.innerHTML += randomItem;
</script>
<p>cannot be a child of a<ul>. Only a<li>caninnerHTMLon the body, try creating a new element that you can then add styles to. developer.mozilla.org/en-US/docs/Web/API/Document/createElement