Disable the previous button in the first page

Disable the previous button in the first page

I've a pop-up to display the user list which would display 10 results per page, which is working fine.

I'm getting the page nos. from the java servlet in the JSON. 
How do I disable the previous button, when it is the first page?
Likewise, how do I disable the last button, when it is the last page?

Here's my code.

  1. function UserList(pageNo) {

  2. var resType="userList";

  3. getResults(resType,pageNo);
  4. $(document).on('click', '.next-btn', function(){
  5. var next = 10+pageNo;
  6. UserList(next);

  7. });
  8. $(document).on('click', '.prev-btn', function(){
  9. var previ = pageNo - 10;
  10. UserList(previ);
  11. });


  12. }