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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:30:58+00:00 2026-06-11T07:30:58+00:00

This is a slightly odd one, note I can’t change the HTML as it’s

  • 0

This is a slightly odd one, note I can’t change the HTML as it’s generated by doxygen.

I’m trying to change how the file browser javascript works, currently if you click on a folder it expands fully all the folders beneath it. Instead I want to just display folders and files that are directly in the folder.

The HTML is something like (invalid html for simplicity here)

<table>
<tr id="row_0" onclick="toggleFolder(0)">Folder1</tr>
<tr id="row_0_0" onclick="toggleFolder(0_0)">Project1</tr>
<tr id="row_0_0_0">File1.c</tr>
<tr id="row_1" onclick="toggleFolder(1)>Folder 2</tr>
</table>

Which represents a structure like:

  • Folder 1
    • Project 1
      • File1
  • Folder 2

Currently doxygen’s javascript toggleFolder function works like the below (I’ve added comments to explain what’s going on).

function toggleFolder(id)
{
  var n = $('[id^=row_'+id+']'); //all rows "beneath" the clicked one
  var i = $('[id^=img_'+id+']'); //img's in rows "beneath" clicked
  var a = $('[id^=arr_'+id+']'); //a's in rows "beneath" clicked
  var c = n.slice(1); //remove the first match (the clicked row)

  //If the first element (reduce matches) is visible hide everything...
  if (c.filter(':first').is(':visible')===true) {
    i.attr('src','ftv2folderclosed.png'); //probably not needed
    a.attr('src','ftv2pnode.png'); //probably not needed
    c.hide();
  } else {
    i.attr('src','ftv2folderopen.png');
    a.attr('src','ftv2mnode.png');
    c.show();
  }
  updateStripes(); //update even/odd classes
}

Instead I just want to select row_0_0 when I click on row_0 and not row_0_0_0, how can I change the selector to implement this?

Thanks for your time!


In the end I used something like the below, based on the accepted answer

Where rows is just a $(tr) equivalent

  //Only match elements AFTER this one (can't hide elements before)
  var childRows = rows.filter(function() {
    re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
    return this.id.match(re);
  });

  //All sub images
  var childImages = childRows.find("img");

  //Only the img images
  var childImg = childImages.filter("[id^=img]");

  //Only the arr images
  var childArr = childImages.filter("[id^=arr]");
  • 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-06-11T07:31:00+00:00Added an answer on June 11, 2026 at 7:31 am

    Replace:

    var n = $('[id^=row_'+id+']');
    

    with:

    var n = $("tr").filter(function() {
        re = new RegExp('^row_'+id+'_\\d+$', "i");
        return this.id.match(re);
    });
    

    The equvialent code will work for images/anchors too (but I not see example in your question, so can’t write correct filter).

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

Sidebar

Related Questions

I'm trying to style up this heading. It slightly pops out the side with
We've run across a slightly odd situation. Basically there are two tables in one
This is a slightly odd problem, which means the solution is probably something trivial
Using a string.CompareTo(string) i can get around this slightly but is not easy to
Im aware this may be a slightly odd question, but given a Page class
I'm trying to use Rails's polymorphic associations in a slightly odd way and I'm
This is a slightly tricky question. I am using NSDateFormatter on the iPhone but
This is a slightly original variation on a common problem. I have a fairly
Apologies if this is a slightly noob question, but looking to clarify my thoughts
OK, this is a slightly weird question. We have a touch-screen application (i.e., no

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.