I have a long list of items in a list item, which I need to go through and add a comma and space and display as a comma seperated string of items:
So i have the following:
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>etc</li>
</ul>
Which I need to be display as the following:
Item 1, Item 2, Item 3, Item 4, etc
<p>Item 1, Item 2, Item 3, Item 4, etc</p>
I am new to javaScript so any help would be great.
Thank
document.getElementsByTagName()and.innerHTML(or.textContentand.innerText), as well as aforloop. Thendocument.createElement()and.appendChild()(if necessary)