skip to Main Content

Html – When firing the click function by cliking the child div, how can get the parent event?

const onMenuItemClick = (event) =>{ console.log("onMenuItemClick data-id",event.target.getAttribute('data-id')); } html (JSX) is like this below, One parent div which has two children div <div onClick={onMenuItemClick} data-id="show"> <div className={styles['contextIconBox']}> <img src={btn_delete} className={styles['contextIcon']}/></div> <div className={styles['contextLabel']}> myarea</div> </div> </div> When cliking this div onMenuItemClick…

VIEW QUESTION
Back To Top
Search