1

I want to add class from jquery to a selected element ::before CSS element. How would I do that? any help?

Here's a screenshot.

enter image description here

I want to add CSS for the above element from jquery.

Pugazh
  • 9,453
  • 5
  • 33
  • 54
  • Add necessary code and describe your issue properly. Do you want to add `::before` from jQuery ?? – Pugazh Apr 01 '16 at 07:46

1 Answers1

2

same question here: Access the css ":after" selector with jQuery

you have to add a class directly to the element and then style it´s :before

example html:

<div>
  text
</div>

CSS:

.before-styling::before{
  content:'before';
}

JS:

$("div").addClass('before-styling');

https://jsfiddle.net/gpydysgm/

Community
  • 1
  • 1
warch
  • 2,387
  • 2
  • 26
  • 43