Hiding parent divs in Jquery

后端 未结 3 740
走了就别回头了
走了就别回头了 2020-12-06 03:03

I am having a simple div structure ( see below ). All I am trying to do is when the div id \"interviewer-Button\" is clicked the following div\'s should appear and when the

3条回答
  •  温柔的废话
    2020-12-06 03:25

    You need to stop propagation of the click event in the handler for the inner element. Without that the handler for the parent will also be invoked. See the jQuery event object for more info.

    $("#elt").click( function (e) {
        e.stopPropagation();
        $(this).parent().parent().hide();
    });
    

提交回复
热议问题