To append content to an HTML element using JavaScript, you can use appendChild() for DOM elements or innerHTML for strings.
Source code viewer
// Get the element you want to append to let container = document.getElementById('container'); // Create a new element let newElement = document.createElement('p'); // Add some content to the new element newElement.textContent = 'This is a new paragraph.'; // Append the new element to the container container.appendChild(newElement); // OR container.innerHTML += '<p>This is another new paragraph.</p>';Programming Language: Javascript