Iterating anchors in jquery doesn't seem to work...

Posted by bala3569 on Stack Overflow See other posts from Stack Overflow or by bala3569
Published on 2010-03-31T05:08:50Z Indexed on 2010/03/31 5:13 UTC
Read the original article Hit count: 349

Filed under:
|

Hai i am generating page numbers based on currentpage and lastpage using jquery ... Here is my function and as i am newbie i dont know how it can be done...

function generatePages(currentPage, LastPage) {
    if (LastPage <= 5) {
        var pages = '';
        for(var i=1;i<=5;i++)
        {
            pages += "<a class='page-numbers' href='#'>" + i + "</a>"
        }
        $("#PagerDiv").append(pages);
    }
    if (LastPage > 5) {
        var pages = '';
        for (var i = 1; i <= 5; i++) {
            pages += "<a class='page-numbers' href='#'>" + i + "</a>"
        }
        $("#PagerDiv").append(pages);
    }
}

I want the result to be like this

If it is the first page

istpage

If it is in the middle,

Pager

If it is the last page,

lastpage

I have the lastPage and currentPage values please help me out getting this...

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about anchor