0

Here I have some html

<label for="timeline-does-not-filter-content-based-one-of-the-following-properties1">::before
"Workflows"</label>

the pseudoclass :before has sometimes applied style

border-width: 4px;

How can I check with jquery that it has border width equal to 4px applied. thanks

Rizwi
  • 117
  • 1
  • 13
  • Possible duplicate of [Selecting and manipulating CSS pseudo-elements such as ::before and ::after using jQuery](https://stackoverflow.com/questions/5041494/selecting-and-manipulating-css-pseudo-elements-such-as-before-and-after-usin) – Laura Jun 21 '18 at 09:40

1 Answers1

0

As explained in the second answer of this question, css :after and :before rules aren't part of the DOM, and therefore can't be altered (or in your case checked) using jQuery's DOM methods.

What you can do is applied the border-width: 4px style based on the label class and check if your label has this class with .hasClass('myClass').

Like:

label.bordered:before {
  border-width: 4px;
}

And check it:

$('label').hasClass('bordered')
Laura
  • 8,100
  • 4
  • 40
  • 50