I am trying to filter the isotope plugin from a separate page, so if a certain link is clicked it will filter the respective elements. I am doing this using cookies more specifically the jQuery.cookie script.
It is working in FF but is throwing a Syntax error, unrecognized expression: [object Object]
error in chrome. The code im using on the home page where the links exist to set the cookie is //set istope cookie $('.iso').on('click', function(){ var isotope = $(this).attr('data-filter'); $.cookie("isotopefilter", isotope , { path: '/' }); });
Then im trying to retrieve the value and use it to filter the elements on the other page
if($.cookie("isotopefilter")){ var cookieValue = $.cookie("isotopefilter"); var newCookieValue = cookieValue.toString(); $container.isotope({ filter: newCookieValue }); $(".filter a").filter(function () { return ($(this).attr('data-filter') == newCookieValue) }).parent().addClass('active'); $(".filter a").filter(function () { return ($(this).attr('data-filter') == newCookieValue) }).parent().siblings().removeClass('active'); }
As I said it all works fine in FF, but it is creating another cookie with the same name in chrome but a different path when I land on the other page, which I think is causing the error.
Any help is much appreciated.