Hello – I am having a problem with a JS function I’m trying to write!
The idea is to find all <div>s with the name “alabama[]” ([0] to however many there are) and hide them.
But, I continue to get “Object Required”. Every way I try to pass the argument, I still get the error.
Here is my function:
[code=html]
function showCounty(terSize,terName) {
for(i=0;i<terSize;i++) {
hide = document.getElementById(“alabamacounty0”);
hide.style.visibility = “hidden”;
}
Here is what I’m passing:
[code=html]
<a href=”#” onclick=”showCounty(2,’alabamacounty’)”>
Hide Me</a>
I’ve tried sending ‘alabamacounty’ with [] at the end and without. Also the same at the top in the function.
My <div>s are as such:
[code=html]
<div id=”alabamacounty[0]”>Test</div>
<div id=”alabamacounty[1]”>Test 2</div>
What am I doing wrong?
Thanks!