Skip to content
Advertisement

How can I filter the column type of the table using two buttons?

I want to filter the type column, one button filters the aquatic and in the other all except the aquatic

JavaScript

Advertisement

Answer

Hopefully this helps point you in the right direction! have a filterTable function which grabs all the table rows, and removes any inline style changes previously added to display. Then, I filter all the trs by the innerHTML content not including the term, and I take all those trs and set their display to none

JavaScript
JavaScript

EDIT refactored based on further clarification in comments

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement