Getting error – Uncaught TypeError: undefined is not a function
-
Hello
I am wrote a jQuery and enqueue it. This is not the first time I am doing this. But stuck this time. jQuery not working. I checked the chrome console and I found in front of my file error message – Uncaught TypeError: undefined is not a function
I unqueue the script in functions.php and it is loading correctly in footer. My code for enqueuing-
function mynew() { wp_register_script('changing',get_template_directory_uri().'/js/change.js','',null,true); wp_enqueue_script('changing'); }
add_action(‘wp_enqueue_scripts’,’mynew’);
Change.js contain this code
jQuery(document).ready(function($) { $('#set1 li').click(function() { $(this).siblings().removeclass('selected'); //remove the 'selected' class from siblings $(this).addclass('selected'); // add the 'selected' class to the clicked item $('.container1 li').hide(); // hide all the second level li's $('.container1 li:eq(' +$(this).index() + ')').show(); //show the same li with same index });
and html code in template file looks like this
<div class="box_set"> <div class="box"> <div id="set1"> <ul> <li class="selected"><img src="<?php bloginfo('template_url'); ?>/images/guaranteed.png" alt="guaranteed" /></li> <li><img src="<?php bloginfo('template_url'); ?>/images/customizable.png" alt="customizable" /></li> </ul> </div><!--set1 end--> <div class="container1"> <ul> <li><img src="<?php bloginfo('template_url'); ?>/images/tree-tuner.png" /></li> <li class="invisible"><img src="<?php bloginfo('template_url'); ?>/images/tree-lock.png" /></li> </ul> </div> <!--container1 end--> <div class="clearfix"></div> </div><!--box end--> </div><!-- box_set end-->
Where is the problem ?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Getting error – Uncaught TypeError: undefined is not a function’ is closed to new replies.