0

So, I know how to change css on click. But how to change .button:after ?

                                    $(".button").click(function(){
                                    $(".button").css('content', "\f176");
                                });

This doesnt work.

2
  • 2
    You can't. Instead, you can add or remove a class and have css styles for the .myNewClass:after. If you need further information on how to do this, leave a comment here and I'll put together a demo to clarify. Commented May 10, 2017 at 23:09
  • @JosephMarikle Thanks! I did that and with toggleClass I can now toggle on and off. Commented May 10, 2017 at 23:38

1 Answer 1

0

You could put a style tag and add the preferred pseudo-elements

<style id="button"></style>

And here:

$(".button").click(function(){
    $("#button").text('button{content: "\f176"}');
});
Sign up to request clarification or add additional context in comments.

Comments