I working in some project.
I need get all classes with styles of any html element
Example
Element:
<a href="#" class="btn btn-transparent-white font-weight-bold py-3 px-6 mr-2">
Agregar Medicamento
</a>
Code JS
var classes = e.target.className.split(' ');
console.log(classes);
Result:
["btn", "btn-transparent-white", "font-weight-bold", "py-3", "px-6", "mr-2"]
With my code I can get styles of classes
.btn
transition: color 0.15s ease 0s, background-color 0.15s ease 0s, border-color 0.15s ease 0s, box-shadow 0.15s ease 0s;
.font-weight-bold
font-weight: 500 !important;
.py-3
padding-bottom: 0.75rem !important;
.px-6
padding-left: 1.5rem !important;
.btn-transparent-white
undefined
But I have a problem with combined styles for example
.btn.btn-white-transparent
Any idea how I can to search any coincidences of element?
Edited:
Thanks for you anwers but I can search single classes , my problem is when I want to search .btn-white-transparent. this is a combined style,
I want to seach .btn-white-transparent
and the anwer will be .btn.btn-white-transparent { color:#FFF}