I need to dynamically create my CSS styles for my elements. However, I need to have :after in CSS and I have heard that you cannot modify this in jQuery.
Is this true? Is there anyway around this?
You can generate a <style>
tag and insert it into the <head>
:
http://jsfiddle.net/PrBHF/
$("head").append($('<style>div:after { content: " World" }</style>'));
Why create css using javascrript?
Have the required styles in a css class and then apply the class using jQuery by using addClass
method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With