JQuery help in fixing console error

Please advise what needs to be done to fix this console error:

The error is generated in the following page:


Under "FAQ", when you click the accordions, you'll notice the console error.

This is the code which is implemented via Custom JS plugin:

var acc = document.getElementsByClassName("accordion")[0];
var i;

for (i = 0; i < acc.length; i++) {
acc.addEventListener("click", function() {
var accpanel = this.nextElementSibling;
if (accpanel.style.maxHeight){
accpanel.style.maxHeight = null;
} else {
accpanel.style.maxHeight = accpanel.scrollHeight + "px";

Please check the chat notes for more info.