Return the display type of a <p> element: - Javascript CSS Style Property

Javascript examples for CSS Style Property:display

Description

Return the display type of a <p> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

<button type="button" onclick="myFunction()">Return the display type of p</button>

<script>
function myFunction() {//from w  w  w  .  j a v a 2s  . c om
    console.log(document.getElementById("myP").style.display);
}
</script>

</body>
</html>

Related Tutorials