JS Error with template's gk.scripts.js

GK User
Fri Sep 28, 2012 9:33 pm
Hey guys,

All of a sudden this JS error started popping up after the latest template upgrade on the events page of my site.

http://www.inthenola.com/events.html

Code: Select all
TypeError: el[i] is undefined


from this line of code:

Code: Select all
//changes for module in jomsocial position
if(document.getElements('.moduletable')){

var el = document.getElements('.moduletable');
var tab = document.getElements('.moduletable h3');

for (var i=0; i < tab.length; i++) {
tab[i].addClass('header').innerHTML = '<span>'+ tab[i].get('html')+'</span>';
el[i].removeClass('moduletable').addClass('box').innerHTML = '<div>'+ el[i].get('html')+'</div>';
Uncaught TypeError: Cannot call method 'removeClass' of undefined
}
}


At first I thought it was another extension causing the error but upon further investigation it's definitely coming from the template.

Thanks for your help in resolving this issue.
User avatar
Junior Boarder

GK User
Sat Sep 29, 2012 11:44 am
Hi,

Please try to replace the following code in gk.scripts.js:

Code: Select all
    //changes for module in jomsocial position
    if(document.getElements('.moduletable')){

        var el =  document.getElements('.moduletable');
        var tab = document.getElements('.moduletable h3');

        for (var i=0; i < tab.length; i++) {   
          tab[i].addClass('header').innerHTML = '<span>'+ tab[i].get('html')+'</span>';
          el[i].removeClass('moduletable').addClass('box').innerHTML = '<div>'+ el[i].get('html')+'</div>';
        }   
    }


to:

Code: Select all
    //changes for module in jomsocial position
    if(document.getElements('.moduletable')){

        var el =  document.getElements('.moduletable');
        var tab = document.getElements('.moduletable h3');

        for (var i=0; i < tab.length; i++) {   
          if(tab[i]) {
              tab[i].addClass('header').innerHTML = '<span>'+ tab[i].get('html')+'</span>';
          }
          if(el[i]) {
              el[i].removeClass('moduletable').addClass('box').innerHTML = '<div>'+ el[i].get('html')+'</div>';
          }
        }   
    }
User avatar
Administrator

GK User
Mon Oct 01, 2012 8:02 pm
That worked. Thanks a lot!
User avatar
Junior Boarder

GK User
Mon Feb 22, 2016 11:52 pm
hi
I'm using this file too here:
http://pruebas.darocaarquitectos.com/en/photograph

when I press over any image, a modal popup is shown. But if I use the tag filter (top-right), inexplicably it doesn't work modal any more!!

Please, could anyone help me?
thx
User avatar
Junior Boarder


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.