Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72416

Using jQuery to manage Database populated Filter name to display a few portfolio items

$
0
0

I have a product page where I have created a filter to sort the product list by its category.

$(document).ready(function() {
  $(".tab").click(function() {
    var value = $(this).attr('data-filter');
    if (value == "all") {
      //$('.filter').removeClass('hidden');
      $('.filter').show('1000');
    } else {
      $(".filter").not('.' + value).hide('3000');
      $('.filter').filter('.' + value).show('3000');
    }
  });

  if ($(".tab").removeClass("active")) {
    $(this).removeClass("active");
  }

  $(this).addClass("active");

Everything works fine, but I have one category named "Power Tool", and only this filter not working for me. I suspect the problem is the whitespace between 'power' and 'tools'.

You can see this code working here: http://www.buildersmart.net/products.php


Viewing all articles
Browse latest Browse all 72416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>