Remove Element by Click
JavaScript
Easy
3 views
Problem Description
You have many elements with class card. When any card is clicked, remove only that card from DOM.
Output Format
No output (DOM change).
Constraints
Assume elements with class card exist.
Official Solution
document.querySelectorAll('.card').forEach(el=>{el.addEventListener('click',()=>{el.remove();});});
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!