In our project, we had the following error:
Uncaught TypeError: Cannot read property 'cls' of undefined

Our fix:
- var sharebar = jQuery(Drupal.settings.sharebar.cls);
- var sharebarx = jQuery(Drupal.settings.sharebar.hrcls);
+ var sharebar = (Drupal.settings.sharebar && Drupal.settings.sharebar.cls) ?
+ jQuery(Drupal.settings.sharebar.cls) :
+ jQuery('#sharebar');
+ var sharebarx = (Drupal.settings.sharebar && Drupal.settings.sharebar.hrcls) ?
+ jQuery(Drupal.settings.sharebar.hrcls) :
+ jQuery('#sharebarx');

Comments

jgsantos’s picture

This solution worked for me too on Drupal 6 version.

alfthecat’s picture

Issue summary: View changes

Worked like a charm! Thanks!

sylvain lavielle’s picture

Same error. here's the patch

  • nmudgal committed a53c9f2 on 7.x-2.x
    Issue #2076219 by moehac: Uncaught TypeError: Cannot read property 'cls...

  • nmudgal committed a745099 on 7.x-1.x
    Issue #2076219 by moehac: Uncaught TypeError: Cannot read property 'cls...
nmudgal’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Active » Fixed

Makes sense. Thanks much guys, committed to 7.x dev!

  • nmudgal committed a53c9f2 on 8.x-1.x
    Issue #2076219 by moehac: Uncaught TypeError: Cannot read property 'cls...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.