I'm using a code that I also found here that filters a table based on a dropdown selection. I'm not well-versed with JQuery/Javascript. My Question is how can I "show all" the data using this code snippet:
dropdown:
- Show All
- Done
- On-going
- Not yet started
$(document).ready(function($) { $('#selectField').change(function() { var selection = $(this).val(); var dataset = $('table').find('tr'); dataset.show(); dataset.filter(function(index, item) { return $(item).find('td:nth-child(1)').text().split(',').indexOf(selection) === -1; }).hide(); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <select id='selectField'> <option value=" "> Show All </option> <option value="Done"> Done </option> <option value="On-going"> On-going</option> <option value="Not yet started"> Not yet started </option> </select> <table border="2"> <tr> <td>Done</td> </tr> <tr> <td>On-going</td> </tr> <tr> <td>Done</td> </tr> <tr> <td>Not yet started</td> </tr> <tr> <td>Not yet started</td> </tr> </table>