0
I am styling radio-button and need to add class according to the text of the button. Actually it is very simple and works with the code below, I need that instead of inserting the data-title="" be inserted as class=""
$('td').each(function() {
$(this).attr('data-title', $(this).text());
});
Ou sem jQuery:
for (let el of document.getElementsByTagName('td')) {
el.dataset.title = el.innerText.trim();
}
I can’t remember the right way.
Face wouldn’t just be changing
data-title
forclass
in that part$(this).attr('data-title', ...
?– hugocsl
That’s right, it went blank! Thank you
– Kim Hanneman