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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:10:53+00:00 2026-05-22T12:10:53+00:00

I’m new to javascript so let me just say that right up front. A

  • 0

I’m new to javascript so let me just say that right up front.

A web site I frequent has 50 or so items, with details about that item, in a table. Each table row contains several td cells. Some rows have types of things that are similar, like USB drives or whatever. I want to capture each row so that I can group and reorder them to suit my tastes.

I have this object:

function vnlItemOnPage(){
  this.Category = "unknown";
  this.ItemClass = "vnlDefaultClass";
  this.ItemBlock = {};
}

This represents one row.

What I’ve been trying to figure out is how to capture the block of html < tr>stuff< /tr> and save it into this.ItemBlock.

That part is pretty easy:

vnlItemOnPage.ItemBlock = element.getElementByClassName('className')[0]

?

That seems pretty straight forward. Am I missing something?

This part I am stuck:

There’ll be 50 of them so I need an array of vnlItemOnPage?

vnlAllItems = ???

var vnlAllItems = [vnlItemOnPage]?

And, how would I add to the array and delete from the array? I probably wont delete from the array if that is complicated don’t bother with it.

Once I capture the < tr> html, I can just append it to a table element like so:

myTable.appendChild(vnlAllItems[0].ItemBlock);

Correct?

I’m open to any suggestions if you think I’m approaching this from the wrong direction. Performance is not a big issue – at least right now. Later I may try to conflate several pages for a couple hundred items.

Thanks for your assistance!

[edit]

Perhaps the second part of the question is so basic it’s hard to believe I don’t know the answer.

The array could be: var vnlAllItems = []

And then it is just:
var row1 = new vnlItemOnPage;
vnlAllItems.push(row1);
var row2 = new vnlItemOnPage;
row2.ItemBlock = element.getElementByClassName(‘className’)[0];

I’d like to close the question but I hate to do that without something about handling the array.

  • 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-22T12:10:54+00:00Added an answer on May 22, 2026 at 12:10 pm

    JQuery is your friend here.

    This will give you the inner HTML for the first row in the body of your desired table:

    var rowHtml = $('table#id-of-desired-table tbody tr:first').html() ;
    

    To get the outer HTML, you need a jQuery extension method:

    jQuery.fn.outerHTML = function() {
      return $('<div>').append( this.eq(0).clone() ).html();
    };
    

    Usage is simple:

    var rowHtml = $('table#id-of-desired-table tbody tr:first').outerHtml() ;
    

    Enjoy!

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,

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.