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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:53:14+00:00 2026-05-28T02:53:14+00:00

I have to send html for a table to an html-to-pdf converter script. My

  • 0

I have to send html for a table to an html-to-pdf converter script. My table must be composed of the <thead> from table1, the <tfoot> from table3 and the <tbody> from table2. I’m putting together the html with jQuery. This is what I have:

$(document).ready(function() {
    var html = $('div.dataTables_scroll').html();//so that changes don't affect the main page
    var h = $(html).find('thead')[0];
    var f = $(html).find('tfoot')[1];
    var b = $(html).find('tbody')[0];
    var newtable = $('<table></table>').append(h, f, b);
    var d = $('<div></div>').append(newtable);
    $('#foo').val(d.html()); //to see what the html looks like   
});

Here‘s a JSFiddle of the whole thing. It works well enough, but I think there should be a more elegant way.

Ideas?

  • 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-28T02:53:15+00:00Added an answer on May 28, 2026 at 2:53 am

    How about this:

    var ctx = $( 'div.dataTables_scroll' )[0];
    
    var html = [
        '<table>',
            '<thead>' + $( 'thead', ctx ).eq( 0 ).html() + '</thead>',
            '<tfoot>' + $( 'tfoot', ctx ).eq( 1 ).html() + '</tfoot>',
            '<tbody>' + $( 'tbody', ctx ).eq( 0 ).html() + '</tbody>',
        '</table>'
    ].join( '' );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table rows of data in html being filled from a CGI application.
I have been trying to send out html emails through a PHP mail script
I have a form which generates an HTML table using a PHP script on
I have a couple of simple forms that send an html-only email. Most clients
I have written some code in my VB.NET application to send an HTML e-mail
I have an html form. I need to send its data to flash on
I have an HTML/XML table generated by AJAX that displays limited columns of a
I need to send HTML emails directly from oracle PL/SQL package. This works almost
I have a collection of rows, I can generate Table(HTML) out of it using
I have a table named Template which I set my messages to send them

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.