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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:16:28+00:00 2026-05-24T01:16:28+00:00

I have an issue where I need to format html that’s stored in a

  • 0

I have an issue where I need to format html that’s stored in a client cache in the following format:

html[0] = '<tr>'
html[1] = '<td>text</td>'
html[2] = '<td>text</td>'

On normal occasions I work directly with the dom and don’t need to go near this cache but sometimes I need to update it like so…

html[1] = '<td><a href="">text</a></td>'

Because of the ‘unusual’ storage of the opening ‘tr’ am I able somehow to construct a new ‘tr’, manipulate it, then render only the opening tag?

$(html[0] + '</tr>');

I’m aware this could be done with regexp but curious to know if there’s a jquery technique I can use.

  • 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-24T01:16:29+00:00Added an answer on May 24, 2026 at 1:16 am

    HTML is not XML. In HTML this is perfectly legal:

    <table>
        <tr>
            <td>Text</td>
            <td>Text</td>
        <tr>
            <td>Text</td>
            <td>Text</td>
    </table>
    

    That means that you don’t have to close the opening <tr> bracket with </tr>.

    You can use the W3C Markup Validation Service to check your HTML for validness.

    You can wrap the text with an anchor like this:

    <!doctype html>
    <html>
    <head>
        <title>Wrap td text</title>
        <script type="text/javascript" 
            src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.2.min.js"></script>
        <script type="text/javascript">
            $(function () {
                var html = [];
                html[0] = '<tr>';
                html[1] = '<td>text</td>';
                html[2] = '<td>text</td>';
                $(html.join(""))
                    .children("td")
                        .each(function () {
                            $(this).html($('<a href="">' + $(this).text() + '</a>'));
                        })
                        .end()
                    .appendTo("table");
            });
        </script>
    </head>
    <body>
        <table>
        </table>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an issue where we need to modify keys for users that are
So here's my issue. I have an image that I need to shrink. The
I have a resource scheduling issue in Java where things need to be sequenced,
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
I have an issue that is driving me a bit nuts: Using a UserProfileManager
I have a HTML string in ISO-8859-1 encoding. I need to pass this string
I have two strings Listing1(one in html format) <ul> <li id=1></li> <li id=2></li> <li
I have the following issue with XSL namespaces. I produce a PDF using FOP
I have a little issue with a application wich is specified the following: I
I have this issue that I can't seem to get my head around... Basically

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.