title: Calculating Viewport dimensions and displaying it dynamically with Jquery
body: <p>I have this functions to calculate the viewport width and height dynamically as the browser window size changes. Now I want to display that values on screen, but it does not work. Any ideas?</p>
  
  <p>JS:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          var viewportWidth = $(window).width();
          var viewportHeight = $(window).height();
               $('viewport').html(viewportWidth);
               $('viewport').html(viewportHeight);
          $(window).resize(function() {
               $('viewport').html(viewportWidth);
               $('viewport').html(viewportHeight);
          });
  &lt;/script&gt;
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div id="viewport"&gt;width and height should be displayed here dynamically&lt;/div&gt;
  </code></pre>
  
  <p>Thank you</p>