Javascript DOM CSS Style visibility Property get

Introduction

Return the visibility type of a <p> element:

alert(document.getElementById("myP").style.visibility);

View in separate window

<!DOCTYPE html>
<html>
<body>

<p id="myP" style="visibility:hidden;">This is a p element.</p>

<button type="button" onclick="myFunction()">Return the visibility type of p</button>
<p id="demo"></p>
<script>
function myFunction() {/* ww  w.j a v  a2  s. c  o  m*/
  document.getElementById("demo").innerHTML = document.getElementById("myP").style.visibility;
}
</script>

</body>
</html>



PreviousNext

Related