I have a question that can be of help to many, the question is that in a form html we make much use of style class (css) to make life easier, it happens that being creating classes for some situations gets boring and many Sometimes we repeat the class but with another name for not remembering that we had already created something similar, for example
<style>
.w30px{ width: 30px; }
</style>
We do this because it's so much easier than just putting style into the
<div class="w30px">TEXTO</div>
The natural creation sequence is: we create the style file (css) then set the classes in the objects within the page as needed.
Great, it makes it much easier, but now comes the question:
How can I create the class at runtime according to the name of the class that is in the object? I would like to automate the creation process just by giving the class a name and a function would create the style.
Example onload page:
<script>
function CriaEstilos(objeto){
var w = substr($(objeto).prop("class"), 1, 2);
$(objeto).css("width", w);
}
</script>
I have not tested the above idea, it is merely illustrative, rsrs
But the idea is to automate the creation of simple classes with a common denominator, in this case the width of the object.