Javascript Event.originalEvent.path IE8 error

1.3k views Asked by At

This code is for collapsing a panel in bootstrap. e.originalEvent.path in IE is not working.

$(document).on('click', '.panel-heading.clickable', function(e) {
        var $this = $(this);
        if($(e.originalEvent.path[0]).attr("href") != "#" && $(e.originalEvent.path[0]).is("a") && !$this.hasClass('panel-collapsed')){
            return false;
        }
        if (!$this.hasClass('panel-collapsed')) {
            $this.parent().children('.panel-body').slideUp();
            $this.addClass('panel-collapsed');
            $this.find('i').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
        } else {
            $this.parent().children('.panel-body').slideDown();
            $this.removeClass('panel-collapsed');
            $this.find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
        }
    }
);

It is working on google chrome but in IE it does not work. Is there available workaround for e.originalEvent.path? Thanks!

0

There are 0 answers