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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:38:57+00:00 2026-05-19T10:38:57+00:00

I have a moderately simple problem, and I am trying to figure out the

  • 0

I have a moderately simple problem, and I am trying to figure out the best approach to implement it.

For those wondering, this is used to scrape data from a non-editable page (can add css,js, but the rest of the content is closed source and not available for editing)

I am iterating through an element (tr for example), and I only want to look at the cases where a certain number of td elements are present.

Eg, For every tr, I only want to consider the case where it has 3 td children

What is the best way to do that?

  • 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-19T10:38:57+00:00Added an answer on May 19, 2026 at 10:38 am

    You could try something like this:

    var result = $('tr').filter( function(){
      return $(this).children('td').length === 3;
    });
    

    You can then do any kind of scraping you like. A simple example:

    result.each( function(i,e){ // for each row
      // e = one of the selected rows
      $(e).children('td').each( function(i,e){ // for each td in the row
        your_scraping_function( e.text() ); // etc.
      });
    });
    

    As @patrick points out below, you can of course chain the scraping process directly to the output of the filter() if it makes sense for your code.

    Edit: Added 'td' selector in children(). Belt and suspenders.

    Edit: Added example of how to walk through results, as per OP comment.

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

Sidebar

Related Questions

I have a moderately simple assignment, to create a PHP/PDO site with login functionality
I need to implement a moderately simple Powerpoint-like tool for the web. The user
I'm scratching my head over this. I have a moderately successful app which has
I am trying to create a moderately complex web page. This is not something
I have a moderately sized dataset in excel from which I wish to extract
I have a moderately complex application using POJOs, and now come to migrated it
Have a look at this picture alt text http://www.abbeylegal.com/downloads/2009-04-01/web%20part%20top%20line.jpg Does anyone know what css
Have someone tried out DeCAL in Delphi 2009? I'm thinking about upgrading from 2007,
I'm trying to create a moderately complex query with joins: SELECT `history`.`id`, `parts`.`type_id`, `serialized_parts`.`serial`,
I'm new to git and I have a moderately large number of weekly tarballs

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.