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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:40:58+00:00 2026-05-11T22:40:58+00:00

I have a big problem. I want to extract text from html table that

  • 0

I have a big problem. I want to extract text from html table that contains input tags, raw text, link tags etc. and display in a new window clean html table with only text.

SAMPLE INPUT

<TABLE id="test">
<TBODY>
<TR>
<TD>TEXT 1</TD>
<TD><a href="/questions">TEXT 2</a></TD>
<TD><input  type="text" value="TEXT 3" ></TD>
</TR>
</TBODY>
</TABLE>

magic things(script) happen(parse) here(this)

OUTPUT

<TABLE  id="test">
<TBODY>
<TR>
<TD>TEXT 1</TD>
<TD>TEXT 2</TD>
<TD>TEXT 3</TD>
</TR>
</TBODY>
</TABLE> 

I searched almost everywhere and i cannot get it to work.
I need this functionality for copy paste.

Any Help.

  • 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-11T22:40:58+00:00Added an answer on May 11, 2026 at 10:40 pm

    Thank you @artlung

    Based on your sample i prepared complete solution
    (copy paste to html file)

    And im asking for reviewing this, maybe it can be done better?

    Complete problem:

    1.Transform HTML table with inputs,anchor, text to new CLEAN Html table with only text

    2.Create new window and transfer prepared Table

    SOLUTION:

    <html>
    <head>
    <title>TEST HTML table with inputs , anchor to text </title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    var tmp = '';
    
    $('table tbody tr').each(function () {   //iterate tr
    tmp += '<tr>';  
    $(this ).find('td').each(function () {  //iterate td
        tmp += '<td>';
        tmp += $(this).text();
        $(this).find('input').each(function () {
                tmp += $(this).val() ;
            tmp += '</td>'; 
        });
    });
    tmp += '</tr>'; 
    });
    
    
    $("#demo_button").click(function(e) {
    myWindow=window.open('','MyNewWindow','width=500,height=300,left=200,top=100');
    myWindow.document.write('<html><head><title>CTRL+C to copy</title></head><body><table><tbody>'  + tmp +  '</tbody></table></body></html>');
    myWindow.document.close();
    myWindow.focus(); 
    });
    
    });
    </script>
    </head>
    <body>
    <div>
    <input type="button" id="demo_button" value="Click Me to open window with clean HTML TABLE prepared for copy"/>
    
    <br/>This is HTML TABLE:
    <TABLE id="test">
    <TBODY>
    <TR> <TD><b>TEXT 1</b></TD> <TD><a href="#">TEXT 2</a></TD> <TD><input  type="text" value="TEXT 3" ></TD> </TR>
    <TR> <TD><span>TEXT 1.1</span></TD> <TD><a href="#">TEXT 2.1</a></TD> <TD><input  type="text" value="TEXT 3.1" ></TD> </TR>
    </TBODY>
    </TABLE>
    
    </div>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 279k
  • Answers 279k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The EventHandlerList is used by classes that provide large numbers… May 13, 2026 at 3:23 pm
  • Editorial Team
    Editorial Team added an answer The number following the 2a specifies the log2 of the… May 13, 2026 at 3:23 pm
  • Editorial Team
    Editorial Team added an answer You want to add an AND clause: AND u.uid NOT… May 13, 2026 at 3:23 pm

Related Questions

I working on project and have problem with threading and update of UI. I
I have a simple, real life problem I want to solve using an OO
Background: I have one Access database (.mdb) file, with half a dozen tables in
Lets say I have two tables - child and parent with many-to-one relation. What

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.