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

  • Home
  • SEARCH
  • 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

Related Questions

I have a big load of documents, text-files, that I want to search for
I have an big problem with an SQL Statement in Oracle. I want to
How would you maintain the legacy applications that: Has no unit tests have big
I have this big data-entry sort of page, a table kind of layout using
I have a simple, real life problem I want to solve using an OO
I have a class that has a big method that calls on a lot
I have a very big problem solving this issue I have 2 tables first
I have big problem. Lets look on the code below: protected void Application_AuthenticateRequest(object sender,
I have a big problem with my SMTP server for sending emails. It's down
I'm using sqlalchemy. The question is simple, but I have a big problem, because

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.