Fixed issue with javascript when filtering by categories.