Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialShaun Glassman
6,496 PointsGetting an "Uncaught TypeError: Cannot read property 'className' of null -- Page is working but what is with this error?
I'm getting a strange error in the console when I run the page. The site runs as expected (I previously think I had some weird caching issues) but with the following error:
Uncaught TypeError: Cannot read property 'className' of null
If I follow where they say the problem is, it's on like 57 of this piece of code: <script type="text/javascript"> (function() { var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\s+)(no-)?'+cs+'(\s+|$)');
request = true;
b[c] = b[c].replace( rcs, ' ' ); //This is line 57
b[c] += ( window.postMessage && request ? ' ' : ' no-' ) + cs;
}());
</script>
My functions file is: <?php require_once('examples/export_wp_filter.php'); ?>
My export_wp_filter.php file is as downloaded from the site: <pre> <?php var_export( $wp_filter ); ?> </pre>
The index page is also default: <title><?php wp_title( '|', true, 'right' ); ?></title>
<?php wp_head(); ?>
<?php wp_footer(); ?>
What could be causing this error and could this be problematic in the future?
Nuno Sarmento
4,400 PointsNuno Sarmento
4,400 PointsHI Shaun,
Change your index.php to :
<title><?php wp_title( '|', true, 'right' ); ?></title>
<?php get_header(); ?>
<?php get_footer(); ?>