For some strange reason I get a weird error.
I have an element (which I'd defined with PHP) that eventuly looks like this:
<span id="l_area_1_5" style="display: inline; ">
...some html inputs and stuff....
</span>
Which I am certain by Inspect Element of the Chrome.
Now when I try to address to it programaticly with this:
document.getElementById("1_area_1_5").style.display = 'none';
I get the Cannot read property 'style' of null
error.
I have no idea what the hell that's supposed to mean, any help?
For some strange reason I get a weird error.
I have an element (which I'd defined with PHP) that eventuly looks like this:
<span id="l_area_1_5" style="display: inline; ">
...some html inputs and stuff....
</span>
Which I am certain by Inspect Element of the Chrome.
Now when I try to address to it programaticly with this:
document.getElementById("1_area_1_5").style.display = 'none';
I get the Cannot read property 'style' of null
error.
I have no idea what the hell that's supposed to mean, any help?
Share Improve this question edited Nov 13, 2011 at 18:41 Ash Burlaczenko 25.5k16 gold badges69 silver badges101 bronze badges asked Nov 13, 2011 at 18:35 eric.itzhakeric.itzhak 16.1k27 gold badges94 silver badges146 bronze badges 1- maybe, The problem is that you are calling the javascript function before loading the actual HTML content.. – T.Todua Commented Sep 25, 2013 at 20:55
1 Answer
Reset to default 13The error means that the element doesn't exist. It's because you have a typo. You wrote 1
instead of l
.
l_area_1_5
1_area_1_5
^