0

i am trying to add css for #sai:after using javascript like this. but this is not working.

$("#sai:before").css({"background":"dodgerblue"});

anyone know how to apply css using js

  • In the linked dup, the accepted answer is not useful, take a look at [vsync's answer](https://stackoverflow.com/a/50782696/1169519) instead. – Teemu Mar 19 '20 at 06:19
  • If the styles to attach are not dynamic, you can avoid overly complex solutions by creating the alternative (class)rules to the stylesheet, and then simply change the class of the element with JS. – Teemu Mar 19 '20 at 06:30

0 Answers0