How to remove an item by clicking on a button?
There is a div with a text button
<div id="elem1"> <p> Этот текст нужно удалить <button id="elem1" onclick="deletedItem()">Удалить</button> </p> </div>
On clicking on the button, I think you need to call the function to remove the div with the desired id. I called it deletedItem ()
But there is such a moment.
These divs can be in N number and the div's id will always be different.
I.e. It is necessary to somehow pass the id of the button to the deletedItem () function (the id of the button matches the id of the div that needs to be deleted).
How can this be done?
The intended function itself:
To place the code, please use CodePen or similar tool. Thanks you!