I am trying to implement a simple addClass and removeClass function that should execute on click. Here is the code snippet:
$('#filter').click(function() {
$(this).closest('fieldset').find('.selectedfilter').removeClass('selectedfilter');
$(this).parent().addClass('selectedfilter');
});
David Thomas shared a helpful JSFiddle demonstrating exactly this: http://jsfiddle.net/davidThomas/eMx7X/
I have a form with the ID 'filter' that includes hidden radio buttons and visible labels which are clickable. The active class is applied to the initially checked label, and it should switch to another label when clicked.
However, on this page , the jQuery function does not seem to work as expected. Not only does the addClass and removeClass fail, but also the Quicksand plugin stops functioning (despite working fine without the short .click function).
I am struggling to identify where the issue lies. Any assistance would be greatly appreciated! The live files can be accessed at:
(relevant lines in section 'quicksand shuffle')