title: How to get width of element in javascript
body: <p>I am trying to get the width and height of an element. My element is a DIV with the id of "page". </p>
  
  <p>The current code is not working as my div has a border and it allows my button to go out of the border. </p>
  
  <p>I have tried the .offsetWidth as well as .clientwidth - Both returned null values.</p>
  
  <pre><code>var buttonState = document.getElementById("clickMe");
  var maxArea = document.getElementById("page");
  var pageWidth = maxArea.width;
  var pageHeight = maxArea.height;
  var screenWidth = 0;
  var screenHeight = 0;
  var buttonSize = 4;
  </code></pre>