You must Sign In to post a response.
  • Category: JQuery

    Client side paging error in jquery

    Hi ,

    I want to make clientside paging in my application.

    following is working fine in my application

    var cnt=4;

    var $pagenumbers = $('<div id="pages"></div>');
    for (i = 0; i < cnt; i++) {
    $(' <a href=\"#\" id=' + (i + 1) + ' class="page">' + (i + 1) + '</a>').appendTo($pagenumbers);
    }
    $pagenumbers.insertAfter('#st');

    this will display 1 2 3 4.

    my requirement is add anchor with << and >> symbols before and after paging numbers like << 1 2 3 4 >> .

    for that i tried following code

    var cnt=4;

    var $pagenumbers = $('<div id="pages"></div>');
    for (i = 0; i < cnt; i++) {
    $(' <a href=\"#\"> '<<'</a> <a href=\"#\" id=' + (i + 1) + ' class="page">' + (i + 1) + '</a> <a href=\"#\"> '>>'</a>').appendTo($pagenumbers);
    }
    $pagenumbers.insertAfter('#st');

    But this is not working .how to solve this

    Regards

    Baiju
  • #758979
    Hello Baiju,

    Refer the below code :

    // Initialize this and store globally for tracking state.
    var currentPage = 1;

    // The feed has 15 items, and we're displaying 5 per page.
    var lastPage = 3;

    function UpdatePaging() {
    // If we're not on the first page, enable the "Previous" link.
    if (currentPage != 1) {
    $('#PrevPage').attr('href', '#');
    $('#PrevPage').click(PrevPage);
    }

    // If we're not on the last page, enable the "Next" link.
    if (currentPage != lastPage) {
    $('#NextPage').attr('href', '#');
    $('#NextPage').click(NextPage);
    }
    }

    Hope somewhat this will help you.
    Mark the answer if it helped you.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "If you can dream it, you can do it."


  • Sign In to post your comments