I have this code here:
document.getElementById('success').style.display("block");
document.getElementById('success').text("aaaa");
and I get this error, why?
Uncaught TypeError: Cannot read property 'style' of null
<span id="success" style="color:#FFF; display:none;"></span>
I moved my code to bottom of the page and I get this new error now
Uncaught TypeError: Property 'display' of object #<CSSStyleDeclaration> is not a function
Should be:
var elSuccess = document.getElementById('success');
elSuccess.style.display = 'block';
elSuccess.innerText = 'aaa';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With