You could still iterate over all instances of a th with a certain id or class name. While using jQuery to do this as the better alternative, you could also still use the name tag and loop over elements by tag name.
Some examples would be:
HTML:
<td class="foo"></td>
<td id="foo"></td>
Using jQuery:
// get element by class name
$(".foo").each(function(){
$(this).css("display", "none");
});
// get element by id
$("#foo").each(function(){
$(this).css("display", "none");
});
Using JavaScript:
// get by class name
var foo = getElementsByClassName("foo");
for(var i = 0; i < foo.length; i++) {
}
// get by id
var foo = getElementById("foo");
for(var i = 0; i < foo.length; i++) {
}
Full example:
It is recommended that you use a class name rather than an id as an id should always be unique while there can be multiple instances of class name.
<html>
<body>
<table>
<th></th>
<td class="foo"></td>
<td class="foo"></td>
<td class="foo"></td>
</table>
</body>
<script>
$( document ).ready(function() {
$(".foo").each(function(){
$(this).css("display", "none");
});
});
</script>
</html>