0

I have a class:

<style>
.jonny {
 color:"red"
}
</style>

in my element:

 <div class=jonny>abc</div> 

I want to check via JavaScript if class jonny have a content. sometime I want even to check where in my source it define. In which .css file it define.

I need to do it in runtime = in JavaScript.

Thank you j.r

j.r
  • 27
  • 1
  • 4
  • The title is misleading. You care about the styles themselves and not about the selector (`class` or not) – vsync Jun 03 '22 at 12:20
  • Hi, I care to know if class name "jonny" have any styles in it. I need it in real time , i need to use javascript to know what are the styles in a current point of time. I did not see any similar questions – j.r Jun 08 '22 at 06:11
  • Why just classes? many other selectors might style your element, it's hard if not impossible to know if a certain element has non-default styles applied to it. For example: `*{ color: red }` – vsync Jun 08 '22 at 07:18

0 Answers0