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 7584849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:01:20+00:00 2026-05-30T19:01:20+00:00

This is my first post, but I’ve been using the site for years. However,

  • 0

This is my first post, but I’ve been using the site for years. However, I’m stuck on what should be a fairly simple problem with pagination. I have a group of links being populated with php,

function create_pagination($page,$echo=false)
  {
    $max_rows = isset($_SESSION['maxListViewRows']) ? $_SESSION['maxListViewRows'] : 15;
    $total_rows = isset($_SESSION['total_rows']) ? $_SESSION['total_rows'] : 1;
    $pages = ceil($total_rows / $max_rows);

    if( $page > $pages) $page = $pages;

    $start_row = $page == 1 ? 1 : ( ($page - 1) * $max_rows ) + 1;

    $rows_disp = ($start_row + $max_rows) <= $total_rows ? ($start_row + $max_rows) - 1 : $total_rows;

    $facility_number_summary = 'Showing ' . $start_row .  ' - ' . $rows_disp  . ' of ' . $total_rows . ' rows.<br /> <p class="carapg">(MESSAGE IRRELEVANT TO THE QUESTION)</p>';

    $pagination_functions = '';

    for($i = 1; $i <= $pages; $i++)
    {
        $pagination_functions.= $i != $page ? '<a href="javascript:void(0);" id="page_' . $i . '" class="page_link">' . $i . '</a>'
                                      : '<span class="page_link" id="page_' . $i . '">' . $i . '</span>';
    }

    $results =  array('facility_number_summary'=>$facility_number_summary, 'pagination_functions'=>$pagination_functions);

    $returned = '<div id="max_left">'  . $results['facility_number_summary'] . '</div>
                 <div id="max_right">' . $results['pagination_functions'] . '</div>
                 <div class="break"></div>';

    if( $echo ){ echo $returned; return; }

    return $returned;
  }

And after that, I parse the div with jquery and compress them.

function draw_pagination(page)
{
if(page == undefined){
    page = 1;
}
var postData = {  'ajax' : 'pagination',
                  'page' : page              };

$.ajax({

    type : "POST",

    url  : "/ajax/account.php",

    data : postData,

    success : 
        function(data){ 
            $("#fac_results_max").html(data);   
            get_page_count();
        }

});

}

function get_page_count()
{
var count = $("#max_right").children().length;

if( count < 11 )
    return;

var content = '';
var spacer  = false;

$("#max_right").children().each(
    function(index)
    {
        if( $(this).html() > 5 && $(this).html() <= ( count - 5 )  )
        {
            $(this).css('display','none');
            if( !spacer )
            {
                content += '...';
                spacer = true;
            }
        }
        else
        {
            content += $(this).html();
        }
    }
);  

$("#max_right").html(content);  
}

I am going to take the elements that are hidden and append them to a div that drops down so that the user can select from them. The problem I’m having is the

content += $(this).html() 

It is only returning the inside of the html, as I expect it to, but I don’t know what to call on it to return the actual html of the entire element referred to by ‘this’. Sorry if it’s a dumb question, but I’m stumped.

Thanks in advance for your responses.

  • 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-30T19:01:21+00:00Added an answer on May 30, 2026 at 7:01 pm

    Try this:

    content += $(this).clone().wrap('<div>').parent().html();

    AFAIK, there exists no nice way to get the contents AND the tags of the element using jQuery, so instead we clone the element, wrap it in <div> tags, bump up to the parent (the <div>) and then get its html.

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

Sidebar

Related Questions

This is my first post, but I have been using this site for a
This is my first post, but I've loved using this site as resource for
This is my first post, I'm new to this site, but I've been lurking
This is my first post here, but I've using this site regularly to help
this is my first post here. I'm using an existing Flash widget but would
this is my first post here but I've been a frequent reader of various
this is my first post to stackoverflow, but I've used this amazing site before.
this is my first post on this website, but I'm all the time getting
This is my first post here. I have a problem. I need to take
Well, this is my first post here and really enjoying the site. I have

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.