Howto: div with onclick inside another div with onclick javascript

前端 未结 11 1999
刺人心
刺人心 2020-11-28 06:03

just a quick question. I\'m having a problem with divs with onclick javascript within each other. When I click on the inner div it should only fire it\'s onclick javascript,

11条回答
  •  温柔的废话
    2020-11-28 06:35

    This is a case of event bubbling.

    You can use

    e.cancelBubble = true; //IE
    

    and

    e.stopPropagation(); //FF
    

提交回复
热议问题