title: Uncaught TypeError: Cannot set property 'className' of null
body: <p>I am using js file for paginate a table. It occurs an error while I am trying to click on next page button. It just show the error like this "Uncaught TypeError: Cannot set property 'className' of null". </p>
  
  <p>Here is my code:</p>
  
  <pre><code>    var oldPageAnchor = document.getElementById('pg'+this.currentPage);
      oldPageAnchor.className = 'pg-normal';
      this.currentPage = pageNumber;
      var newPageAnchor = document.getElementById('pg'+this.currentPage);
      newPageAnchor.className = 'pg-selected'; 
  </code></pre>