0

My jsx:

return (
  <div onClick={this.clickondiv}>
   <i className="zmdi zmdi.." onClick={this.clickonicon} /> 
  </div>
)

How do I prevent the onClick event on the div when I click on the icon?

1 Answer 1

4

You can stop the event from propegating up the DOM tree. In your clickonicon do this.

clickonicon(e){
    e.stopPropagation();
    //Rest of the clickonicon code
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.