title: Javascript: getValueProperty of null?
body: <p>I am trying to write a single function to move an element, but I am encountering this error:</p>
  
  <p><strong>Uncaught TypeError: Cannot call method 'getPropertyValue' of null</strong> </p>
  
  <pre><code>    function Mover() {
  
      this.move = move;
  
      // Name of the moving element, property to change, endPoint - where to end the movement
      function move(element, property, endPoint) {
  
          var element = document.getElementById(element);
  
    // Get value of the desired property and turn it into number so that it can be incremented
          var propertyValue = window.getComputedStyle(element).getPropertyValue(property);
  
          var propertyValueInt = parseInt( propertyValue.substr(0,propertyValue.length-2) );
  
  // This is where error starts: for some reason it says the aforementioned error
          var moveit = function() {
  
              propertyValueInt = propertyValueInt + 1;
              element.style.property = propertyValueInt + "px";
  
          };
  
          window.setInterval(moveit, 500);
  
      }
  
  }
  </code></pre>
  
  <p>Where could the error be? I realize that it somehow rewrites the <strong>element</strong> property so that it is null, but why?</p>
  
  <p>Thank you</p>