Skip to content

Instantly share code, notes, and snippets.

@slackorama
Created July 8, 2009 19:59
Show Gist options
  • Save slackorama/143134 to your computer and use it in GitHub Desktop.
Save slackorama/143134 to your computer and use it in GitHub Desktop.
// from
// http://stackoverflow.com/questions/1100066/filter-table-from-select-input-using-jquery/1100201
//
// basically, filter a table on a page based on rows chosen from a dropdown
$('select').change( function(e) {
var letter = $(this).val();
$('tr').each( function(rowIdx,tr) {
$(this).hide().find('td').each( function(idx, td) {
if( idx === 0 || idx === 1) {
var check = $(this).text();
if (check && check.indexOf(letter) == 0) {
$(tr).show();
}
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment