I cannot get the visibility
or display
properties to work.
Here is the HTML footer:
<div id="footer">
©
<strong id="foot" onmouseover="showData();" onmouseout = "hideData()">
Exquisite Taste 2012
</strong>
<input type='checkbox' id="remember" onclick='editCookie()' style="visibility:hidden;" />
</div>
Here is the .js function with the visibility part not working:
function showData()
{
document.getElementById("remember").visiblity="visible";
document.getElementById("foot").innerHTML = getDate() + " " + getTime();
if(cookieValue())
{
document.getElementById("remember").checked = true;
}
}
That one line doesn't seem to do anything:
document.getElementById("remember").visiblity="visible";
display:none means that the tag in question will not appear on the page at all (although you can still interact with it through the dom). There will be no space allocated for it between the other tags. visibility:hidden means that unlike display:none, the tag is not visible, but space is allocated for it on the page.
The getElementById() method returns null if the element does not exist.
CSS Display − none does not render the element on the document and thus not allocating it any space. CSS Visibility − hidden does renders the element on the document and even the space is allocated but it is not made visible to the user.
visible = function() { return this. each(function() { $(this). css("visibility", "visible"); }); }; }(jQuery));
There are two problems in your code:
visibility
and not visiblity
..style
property.It's easy to fix. Simple replace this:
document.getElementById("remember").visiblity
with this:
document.getElementById("remember").style.visibility
This is the job for style
property:
document.getElementById("remember").style.visibility = "visible";
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