Div nested div, parent div binds the click event. After clicking on the child div, how to tell if the click comes from the child div click event in the parent div click event!

 <div id="div1" >
    <div id="div2">
    </div>
</div>

$("-sharpdiv1").on("click",function(){
    //div2
})
Mar.04,2021

give you a style and structure


div <br>$('-sharpdiv1').on('click',function(event){

console.log(event.target);

})

Menu