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.

trgt
  • 61
  • 1
  • 5
  • 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. – Joseph Marikle May 10 '17 at 23:09
  • @JosephMarikle Thanks! I did that and with toggleClass I can now toggle on and off. – trgt May 10 '17 at 23:38

1 Answers1

1

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"}');
});
alessandrio
  • 4,282
  • 2
  • 29
  • 40