WordPress jQuery error: "Uncaught TypeError: Cannot set property 'value' of null"
I've searched through a slew of tangentially related questions to this, but not precisely, so here goes:
I've been working on a site that's (unfortunately) using three different jQuery plugins in WordPress (image carousel on index, image gallery plugin "Galleria" on Portfolio pages, Custom Contact Form 7 on Contact Us page).
With some help I've been able to eliminate most of the errors it's been throwing me as a result, but I'm left now with a final one:
Uncaught TypeError: Cannot set property 'value' of null
I've split things up so that the following is called in header.php:
<link href="http://www.cypresshilldevelopment.com/wp-content/themes/CHD2/galleria.css" rel="stylesheet" type="text/css" media="screen, print"/>
And then the rest is called in footer.php:
<script type="text/javascript" src="http://www.cypresshilldevelopment.com/wp-content/themes/CHD2/galleria_wp/js/jquery.galleria.js"></script>
<script type="text/javascript">
$ = jQuery;
$(function(){ $('ul.gallery').gal开发者_如何学运维leria({tempClass: 'active', thumbnail_caption: ''}); })
</script>
<!-- script for jQuery image carousel -->
<script type="text/javascript" src="/wp-content/themes/CHD2/js/jquery.cycle.all.min.js"></script>
<script type="text/javascript" src="/wp-content/themes/CHD2/js/jquery.easing.compatibility.js"></script>
<script type="text/javascript" src="/wp-content/themes/CHD2/js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="/wp-content/themes/CHD2/js/app.js"></script>
<!--[if lte IE 6]>
<script type="text/javascript" src="supersleight-min.js"></script>
<![endif]-->
What am I doing wrong here? Did I split up the code incorrectly? The error points to a line in the code WordPress is generating for the page defining a value for wphc_value
, but for the life of me I haven't been able to find any reference to "wphc" in any php or js file being used.
Don't know if this is the cause of the error message, but you need to load a theme (loadTheme) for Galleria before initializing it.
http://galleria.aino.se/docs/1.2/getting_started/beginners_guide/
Also, don't know why you have $ = jQuery;
, you probably don't need it.
精彩评论