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".
Here is my 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';