Help with simple (6 line) plugin
I found this plugin online at:
http://geekswithblogs.net/ignu/archive/2008/10/19/125934.aspx and its supposed to work as a filter for tables.
you just do:
-
$("#myFilter").tableFilter("#myTable");
It works just fine with just one table... but if you do a second
-
$("#mysecondFilter").tableFilter("#mysecondTable");
then both filters will filter just the secondTable... I have no experience in writing plugins but Im sure there is an easy fix to this... anyone that has any ideas please help, heres the whole plugin code
-
/// <reference path="jquery.js"/>
$.fn.tableFilter = function(tableSelector) {
table = $(tableSelector);
updateTable = function() {
table.find('tr:gt(0)').hide();
table.find('td:contains("' + $(this).val() + '")').parents('tr').show();
}
$(this).keyup(updateTable);
}