change class on filter submit

jbadiag

Member
Hi, How can I do to change the class of a div when the filter its submitted by button submit?
Thanks
 
You'd have to write a little Javascript, to fire on the click event of the button, and modify the class accordingly.

-- hugh
 
Yes I know but could you explain me a little bit more? Where do I put the code? Any example of javascript? Thanks
 
OK ...I'll be nice and write it for you. :)

So if you wanted to add the class 'red' to the clear filters link when the Go button is pressed ...

Code:
requirejs(['fab/fabrik'], function () {
   jQuery('.fabrik_filter_submit').click(function() { 
      alert("clicked");
       jQuery('.clearfilters').addClass('red');
   });
});

That's off the top of my head, but should work.

-- hugh
 
Actually, as you aren't relying on any Fabrik JS to load, you don't really need the requirejs() part, you could wrap it in a simpler jQuery(document).ready() instead, but either will work.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top