i have this table with crazy amount of data,i was wondering isn’t there any way to access all <th>elements and set an attribute which will be apllied to all of them?
for instance-
<tr>
<th colspan="7"> title </th>
</tr>
i just wanna declare them in the beginning so that i don’t have to set each one of them, when i have a massive amount of data! :S
It’d be better if you assigned a class, but as long as you don’t have any other “th” elements to get in the way, you could target them on their own too.
you can use queySelecorAll() to select all the th, you get an html collection (array-like data structure) over which you can loop, and add the attribute to each element