Javascript DOM CSS Style whiteSpace Property get

Introduction

Return the whiteSpace property

alert(document.getElementById("myDiv").style.whiteSpace);

View in separate window

<!DOCTYPE html>
<html>
<body>

<div id="myDiv" style="white-space:nowrap;">
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
</div>/* w ww  .ja v a  2s. c  o  m*/
<br>

<button type="button" onclick="myFunction()">Return the whiteSpace property</button>

<p id="demo"></p>
<script>
function myFunction() {
  document.getElementById("demo").innerHTML = document.getElementById("myDiv").style.whiteSpace;
}
</script>

</body>
</html>



PreviousNext

Related