Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6826979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:12:43+00:00 2026-05-26T22:12:43+00:00

I have come across the following code that looks at divs contained inside divWiz

  • 0

I have come across the following code that looks at divs contained inside divWiz and separates them into two halves which the user can switch between.

This is all well and good, but what about if I wanted to make it more dynamic? By that I mean throwing in some pagination.

Using the code below you see that I am generating 50 divs. The code splits them into two even sets of 25 that can be swtiched between using the Next and Previous buttons.

See jsfiddle for working example

Now lets say I want to limit the number of shown divs to 10 instead of 50. I have no idea how to get the navigation between these sets of 10 to generate.

Basically, instead of Next and Previous, I want to see Page: 1, 2, 3, 4, etc

HTML

<input value=" Next " type="button"/>
<input value=" Prev " type="button"/>
<input value=" Show All " type="button"/>
<div id="divWiz"></div>

Javascript

$(function() {
var i, cutoff, total = 50;
for(i=0; i<total; ++i)
    $(document.createElement("div")).html(i).appendTo("#divWiz");

cutoff = total/2;

$("#divWiz > div").hide();
$("#divWiz > div:lt("+cutoff+")").show();

$("input[value=' Next ']").click(function() {       
    $("#divWiz > div").hide();        
    $("#divWiz > div:gt("+(cutoff - 1)+")").show();
});

$("input[value=' Prev ']").click(function() {       
    $("#divWiz > div").hide();        
    $("#divWiz > div:lt("+cutoff+")").show();    });    

$("input[value=' Show All ']").click(function() {       
    $("#divWiz > div").show();        
});        
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:12:44+00:00Added an answer on May 26, 2026 at 10:12 pm

    I recommend you look at one of the slew of pagination plugins. A couple of lightweight examples:

    http://geckohub.com/jquery/simplepager/

    http://www.jquery4u.com/demos/jquery-quick-pagination/

    More:

    http://www.jquery4u.com/plugins/10-jquery-pagination-plugins/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have come across the following jQuery code but could not understand it. What
I have come across the following type of code many a times, and I
I have come across the following code in C#. if(condition0) statement0; else if(condition1) statement1;
I am just starting .Net development (C#) and have come across some code that
I’m looking at some C# code, and have come across the following statement: #if
I have come across the following example code: EXECUTE msdb.dbo.sysmail_add_profileaccount_sp @profile_name = @'SQL mail
I am writing an API and have come across the following pattern: My API
I am a newbie to Python and have come across the following example in
While attempting my first sub-class in Objective-C I have come across the following warning
I have come across a lot of optimization tips which say that you should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.