I have read that you can have a class and ID in a Div which is what I am trying to do but it doesn't seem to be working. When the page loads it creates a list based on an SQL query. Each of the text boxes should get a unique id and all of them should be hidden and so I have given a general class name to the Div. The HTML returned looks correct but the debugger says:
TypeError: undefined is not an object (evaluating 'document.getElementsByClassName('unknownTextField').style.visibility = 'hidden'')
<script type="text/javascript">
    window.onload = function () {
        document.getElementsByClassName('unknownTextField').style.visibility = 'hidden';
    }
</script>
The Div
The loop $rowNumber loops through the list
<div class='unknownTextField' id='qualTypeUnknown<?php echo $rowNumber ?>'>
<input type='text' name='unknown<?php echo $qualType ?>'>
</div>
Can anyone see what I am doing wrong?
 
     
     
     
     
    