Why can't I insert click(function() to .spoiled

(Sylwia) #1

Wants to insert an extra css class for the active button when hover

jQuery(".spoiled").click(function(){
   jQuery(this).toggleClass('active');
});

but I’m getting this error.

Error: Invalid CSS after "jQuery(": expected selector, was '"spoiled").click(fu'
        on line 37 of theme_5/theme_field.scss
        from line 1 of theme.scss
>> jQuery("spoiled").click(function(){

Is it theme/plugin fault or my fault?

(Régis Hanol) #2

What you wrote is not CSS, but JavaScript. Hence the error.

3 Likes