1

I have figured out how to make my page work the way I want it to, but now the problem is my last blurb of JavaScript is making it take very long to load. All it does is hide duplicate rows. I cannot delete them.

Which is quite large. Everything runs very smoothly until this blurb of js. I am not too familiar with any front end, so I might be missing some little aspect. Right now the js sits at the bottom of my HTML code.

var arr = $("#fungi tr");

$.each(arr, function(i, item) {
  var currIndex = $("#fungi tr").eq(i);
  var matchText = currIndex.children("td").eq(1).text();
  $(this).nextAll().each(function(i, inItem) {
    if (matchText === $(this).children("td").eq(1).text()) {
      $(this).hide();
    }
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<table id="fungi" border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th>Family Name</th>
      <th>Genus Name</th>
      <th>Spore Print Colour Description</th>
      <th>Spore Print Colour 1</th>
      <th>Spore Print Colour 2</th>
      <th>Habitat</th>
      <th>Habitat Description</th>
      <th>Ecology</th>
      <th>Size</th>
      <th>Unique Cap Features</th>
      <th>Cap Description</th>
      <th>Partial Veil</th>
      <th>Gill Description</th>
      <th>Gill Attachement</th>
      <th>Unique Stipe Features</th>
      <th>Stipe Description</th>
      <th>Additional Features of Note</th>
      <th>Similar Genera / Look-alikes</th>
      <th>Additional Information</th>
      <th>Top Five NE Species</th>
      <th>Species to Species Identification Difficulty</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Fibrous</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Free</td>
      <td class="check6">Hollow</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Fibrous</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Free</td>
      <td class="check6">None</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Scaly</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Free</td>
      <td class="check6">Hollow</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Scaly</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Free</td>
      <td class="check6">None</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">None</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Free</td>
      <td class="check6">Hollow</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">None</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Free</td>
      <td class="check6">None</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Fibrous</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Barely Attached</td>
      <td class="check6">Hollow</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Fibrous</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Barely Attached</td>
      <td class="check6">None</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Scaly</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Barely Attached</td>
      <td class="check6">Hollow</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Scaly</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Barely Attached</td>
      <td class="check6">None</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">None</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Barely Attached</td>
      <td class="check6">Hollow</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">None</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Barely Attached</td>
      <td class="check6">None</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
  </tbody>
</table>

6
  • 2
    Why not filter the markup properly before serving it to the browser? If this is static markup, filter it by hand once. If this is dynamic content, generated by PHP or something else, fix it on the server Commented Aug 10, 2022 at 12:32
  • Why are you using jQuery in 2022? Also, your code has nested loops so you can probably optimize it... and I don't like the look of nextAll either... Commented Aug 10, 2022 at 12:34
  • @Dai don't bash jQuery. It still has it's uses Commented Aug 10, 2022 at 12:35
  • @evolutionxbox I strongly, though respectfully, disagree. Commented Aug 10, 2022 at 12:35
  • Off-topic, but using text-align: right; with table-cells containing text is bad for readability. Commented Aug 10, 2022 at 12:37

2 Answers 2

3

This is faster and simpler if you MUST do this on the client

Vanilla JS - notice the swap of i and item and not much else

const arr = document.querySelectorAll("#fungi tbody tr");
arr.forEach((item,i) => {
  if (i<1) return;  
  const text = item.querySelector("td:nth-child(1)").textContent;
  item.hidden = text === arr[i-1].querySelector("td:nth-child(1)").textContent;
});

jQuery

const $arr = $("#fungi tbody tr");
$arr.each(function(i, item) {
  if (i<1) return;  
  const text = $("td:nth-child(1)",this).text()
  this.hidden = text === $arr.eq(i-1).find(":nth-child(1)").text()
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<table id="fungi" border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th>Family Name</th>
      <th>Genus Name</th>
      <th>Spore Print Colour Description</th>
      <th>Spore Print Colour 1</th>
      <th>Spore Print Colour 2</th>
      <th>Habitat</th>
      <th>Habitat Description</th>
      <th>Ecology</th>
      <th>Size</th>
      <th>Unique Cap Features</th>
      <th>Cap Description</th>
      <th>Partial Veil</th>
      <th>Gill Description</th>
      <th>Gill Attachement</th>
      <th>Unique Stipe Features</th>
      <th>Stipe Description</th>
      <th>Additional Features of Note</th>
      <th>Similar Genera / Look-alikes</th>
      <th>Additional Information</th>
      <th>Top Five NE Species</th>
      <th>Species to Species Identification Difficulty</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Fibrous</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Free</td>
      <td class="check6">Hollow</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Fibrous</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Free</td>
      <td class="check6">None</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Scaly</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Free</td>
      <td class="check6">Hollow</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Scaly</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Free</td>
      <td class="check6">None</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">None</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Free</td>
      <td class="check6">Hollow</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">None</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Free</td>
      <td class="check6">None</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Fibrous</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Barely Attached</td>
      <td class="check6">Hollow</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Fibrous</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Barely Attached</td>
      <td class="check6">None</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Scaly</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Barely Attached</td>
      <td class="check6">Hollow</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">Scaly</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Barely Attached</td>
      <td class="check6">None</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">None</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Barely Attached</td>
      <td class="check6">Hollow</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
    <tr>
      <td>Agaricaceae</td>
      <td>Agaricus sp.</td>
      <td>Chocolate-Brown / Purple-Brown</td>
      <td class="check1">Brown</td>
      <td class="check2">Chocolate-Brown</td>
      <td class="check3">Ground</td>
      <td>Ground | Various. Roadsides, Grass, Meadows, Woodland... etc.</td>
      <td>Saprobic</td>
      <td class="check4">Medium</td>
      <td class="check5">None</td>
      <td>Fibrous / Scaly / None | Glabrous or with flattened fibers, not brightly coloured. Fleshy</td>
      <td class="check7">Yes</td>
      <td>Free / Barely Attached | Remote from stem. Pink when young. Dark brown and free or almost free at maturity. Close / Crowded</td>
      <td class="check8">Barely Attached</td>
      <td class="check6">None</td>
      <td>Hollow / None | n/a</td>
      <td>Medium / Large | Veil: Yes | Flesh thick, white. Usually white / gray / brown. Flesh, cap margin, base of stipe can often bruise yellow / red.</td>
      <td>Agrocybe are smaller and don't always have a partial veil.</td>
      <td>Chemical Reactions: KOH- negative or yellow-orange</td>
      <td>Agaricus bitorquis, Agaricus arvensis, Agaricus campestris, Agaricus nanaugustus, Agaricus xanthodermus</td>
      <td>Contains many species. Some are easy, some are extremely difficult.</td>
    </tr>
  </tbody>
</table>

Sign up to request clarification or add additional context in comments.

1 Comment

This works, thank you! Now I realize that the filter doesn't work correctly if I hide rows like this. hmm..
0

I can suggest a small improve, instead of checking every element with every other element just check every element with the elements bellow and only if they are not already hideen.

$.each(arr, function(i, item) {
    const matchText = item.children("td").eq(1).text();
    if(!item.is(":hidden")){
        $.each(arr, function(j, inItem) {
            if(i<j && matchText===inItem.children("td").eq(1).text()) {
                $(this).hide();
            }
        });
    }
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.