Title: Filtering JS not working
Last modified: August 31, 2016

---

# Filtering JS not working

 *  [stever7](https://wordpress.org/support/users/stever7/)
 * (@stever7)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/filtering-js-not-working/)
 * I can’t get the filtering example you have listed on your site to work. The example
   I’m using is the one on this page:
    [https://connekthq.com/plugins/ajax-load-more/examples/filtering/#javascript](https://connekthq.com/plugins/ajax-load-more/examples/filtering/#javascript)
 * I’m adding the JS to the footer of my site and when I click the filter link my
   console says “Uncaught TypeError: $.fn.almFilter is not a function”
 * Here’s the nav code:
 *     ```
       ul id="alm-filter-nav">
         <li><a href="#" data-repeater="default" data-post-type="post" data-posts-per-page="3" data-scroll="false" category="learning" data-button-label="Load More Work">Learning</a></li>
         <li><a href="#" data-repeater="default" data-post-type="ajax_more" data-posts-per-page="5" data-scroll="true" data-button-label="Load More Articles">Recent Articles</a></li>
       </ul>
       ```
   
 * And here’s the shortcode (which initially loads fine):
 *     ```
       <?php
       echo do_shortcode('[ajax_load_more repeater="default" post_type="post" scroll="false" posts_per_page="8" button_label="Learning"]');
       ?>
       ```
   
 * [https://wordpress.org/plugins/ajax-load-more/](https://wordpress.org/plugins/ajax-load-more/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/filtering-js-not-working/#post-7005806)
 * Hi Steve,
    Are you adding the script to a js file, or directly in your footer?
   Is it possible to share a link?
 * CHeers,
 *  Thread Starter [stever7](https://wordpress.org/support/users/stever7/)
 * (@stever7)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/filtering-js-not-working/#post-7005954)
 * It’s on a test site:
    [http://staging.cudenvertoday.org/new-find-articles/](http://staging.cudenvertoday.org/new-find-articles/)
 * And yes, the JS is loading in the footer, after the ajax-load-more.min.js loads(
   which happens to load in the header.)
 * I’ve also tried adding the JS directly in the footer, but that didn’t work either.
 * Thanks for your help!
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/filtering-js-not-working/#post-7005979)
 * Can you try adding `})(jQuery);` to the bottom of your function call?
 *     ```
       $(function() {
   
          // Filter Ajax Load More
          var alm_is_animating = false;
          $('#alm-filter-nav li').eq(0).addClass('active'); // Set the initial button active state
   
          // Nav btn click event
          $('#alm-filter-nav li a').on('click', function(e){
             e.preventDefault();
             var el = $(this); // Our selected element     
   
             if(!el.hasClass('active') && !alm_is_animating){ // Check for active and !alm_is_animating
                alm_is_animating = true;
                el.parent().addClass('active').siblings('li').removeClass('active'); // Add active state       
   
                var data = el.data(), // Get data values from selected menu item
                    transition = 'fade', // 'slide' | 'fade' | null
                    speed = '300'; //in milliseconds
   
                $.fn.almFilter(transition, speed, data); // reset Ajax Load More (transition, speed, data)
             }
          });
   
          $.fn.almFilterComplete = function(){
             alm_is_animating = false; // clear alm_isanimating flag
          };
   
       })(jQuery);
       ```
   
 *  Thread Starter [stever7](https://wordpress.org/support/users/stever7/)
 * (@stever7)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/filtering-js-not-working/#post-8165702)
 * I can’t get your code to work in IE. It appears to work OK in Chrome and Firefox
   though. See [http://cudenvertoday.org](http://cudenvertoday.org) homepage, scroll
   down to the “CU Denver News” section where I have your filter by category in 
   place. In IE, each time I click a category it brings me to the top of the page
   and does not trigger the filter.
 * I’ve tried your solution above, but that didn’t work. Can you take a look at 
   the code?
 * Thanks,
    Steve

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Filtering JS not working’ is closed to new replies.

 * ![](https://ps.w.org/ajax-load-more/assets/icon-256x256.png?rev=2944639)
 * [Ajax Load More – Infinite Scroll, Load More, & Lazy Load](https://wordpress.org/plugins/ajax-load-more/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-load-more/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-load-more/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-load-more/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-load-more/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-load-more/reviews/)

## Tags

 * [filter](https://wordpress.org/support/topic-tag/filter/)

 * 4 replies
 * 2 participants
 * Last reply from: [stever7](https://wordpress.org/support/users/stever7/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/filtering-js-not-working/#post-8165702)
 * Status: not resolved