I need help to resolve exception in chrome console for below script. (I am not proficient in JavaScript.)
Exception is
Uncaught TypeError: Cannot read property 'indexOf' of undefined
The line with indexOf
is throwing the error.
document.onclick = function(e){
var target = e.target ? e.target : e.srcElement;
if($(target).attr('class').indexOf('abcd') == -1 && $(target).attr('class').indexOf('js-toggle') == -1){
$(".nav-mn").animate({left:"-270px"},200);
$("body").animate({left:"0px"},200);
$(".nav-mn").removeClass("open");
}
}