I have a div
element that contains a number of images. When the user clicks a button, I want the contents of the div
to be removed (not the div
itself, I want to reuse the div
to potentially add new content).
In my HTML, the div
and button
are defined as:
<body>
...
<div class="MyDiv"></div>
...
<button id="removeDiv" onclick="removeDivFunction()">remove Div Function</button>
...
</body>
How do I write a function that removes all elements from this div
?