I want to create a button with a svg icon in it. When clicking on the “button”, I want to fire an event based on the parent class. But `event.target.parentElement.className` does not work when clicking on the svg element.
How do I get the class **btn_main** regardless where I click on the “button”? (on the text, icon or empty area) Now I get the className only when clicking on the text…
@SempervivumJun 25.2022 — #Try to use the same procedure we used several times before: Get parent element by the function closest: ``<i> </i>function keep_open(event) { const prnt = event.target.closest('.btn_main'); if (prnt) { console.log('clicked inside .btn_main'); } }<i> </i>``
@Arunprakash01Jun 25.2022 — #I like this article very much. The content was good. If any of the business person are looking for inventory management software, I found this site and they are providing the best service to the business person regarding the mobile app development company..