• In v2.15,
    • The filter_anyMatch widget option was completely removed. Sorry for not deprecating this option, but the filter any match code was completely rewritten.
    • Added a filter_external widget option to only accept a jQuery selector string/object; please see the updated filter any match demo for more details.
  • Added & set filter_saveFilters to true (default is false) in this demo (v2.14).
  • Hover over the grey bar below the table header to open the filter row. Disable this by setting filter_hideFilters option to false.
  • This widget uses jQuery's .nextUntil() function which is only available is jQuery version 1.4+.
  • This widget does work with tablesorter v2.0.5.
  • Using the filters:
    Type (1)(2)DescriptionExamples
    textAny text entered in the filter will match text found within the columnabc (finds "abc", "abcd", "abcde", etc); (finds "Aaron" and "Philip Aaron Wong")
    ~Perform a fuzzy search (matches sequential characters) by adding a tilde to the beginning of the query (v2.13.3) (matches "Bruce Lee" and "Brenda Dexter") or (matches "Philip Aaron Wong")
    "To exactly match the search query, add a quote, apostrophe or equal sign to the beginning and/or end of the queryabc" or abc= (exactly match "abc"); or (exactly match "John")
    ?Wildcard for a single, non-space character.J?n (finds "Jan" and "Jun", but not "Joan"); (finds "Dumass" and "Evans", but not "McMasters")
    *Wildcard for zero or more non-space characters.B*k (matches "Black" and "Book"); (matches "Dumass", "Evans" and "McMasters")
    /\d/Add any regex to the query to use in the query/b[aeiou]g/i (finds "bag", "beg", "BIG", "Bug", etc); (matches text that ends with an "r")
    < <= >= >Find alphabetical or numerical values less than or greater than or equal to the filtered query (2). (find values greater than or equal to 10)
    !Not operator. Filter the column with content that do not match the query.!fe (hide rows with "female" in that column, but shows rows with "male"); (find text that doesn't contain an "a")
     &&  or  AND Logical "and". Filter the column for content that matches text from either side of the && bat (matches a column cell that contains both "box" and "bat"); (Find text that contains both "br" and "c")
    | or  OR Logical "or" (Vertical bar). Filter the column for content that matches text from either side of the bar (3).box|bat (matches a column cell with either "box" or "bat"); (Find text that contains either "Alex" or "Peter")
     -  or  to Find a range of values. Make sure there is a space before and after the dash (or the word "to") (4). or (match values between 10 and 30)
    (1) You cannot combine these operators with each other (except for the wildcards).
    (2) The filter order (or precendence) of how searches are checked is as follows: regex (/\d/) > operators (< <= >= >) > exact (") > not match (!) > and ( AND ) > range ( - ) > wild/or (?, * and  OR ) > fuzzy (~); so an exact match will override "and", "or" and "range" searches (*NOTE* order changed in v2.15, operators prioritized before exact; see issue #465)
    (3) Logical "or" comparisons can now show exact matches (by default; v2.10.1) or just match cell contents.
    (4) In tablesorter v2.10, comparisons can be made in date columns (if properly parsed).


Filter widget defaults (added inside of tablesorter widgetOptions)

  • filter_anyMatch : null - jQuery selector string (or jQuery object) of external anyMatch filter (removed in v2.15; please see the demo for more details).
  • filter_childRows : false - if true, filter includes child row content in the search.
  • filter_columnFilters : true - if true, a filter will be added to the top of each table column.
  • filter_cssFilter : '' - extra css class name(s) applied to the table row containing the filters & the inputs within that row. This option can either be a string (class applied to all filters) or an array (class applied to indexed filter).
  • filter_defaultAttrib : 'data-value' - this option contains the name of the data-attribute which contains the default (starting) filter value.
  • filter_external : '' - jQuery selector (or object) pointing to an input to be used to match the contents of any column; please refer to the updated filter-any-match demo for limitations (v2.15).
  • filter_filteredRow : 'filtered' - css class name added to filtered rows (rows that are not showing); needed by pager plugin.
  • filter_formatter : null - add custom filter elements to the filter row.
  • filter_functions : null - add custom filter functions using this option.
  • filter_hideFilters : false - if true, filters are hidden initially, but can be revealed by clicking on the filter icon *.
  • filter_ignoreCase : true - if true, make all searches case-insensitive.
  • filter_liveSearch : true - if true, search column content while the user types (with a delay). If false, the user must press enter to start the search. If set to a number, when the length of the input text reaches this minimum length, a search will initiate.
  • filter_onlyAvail : 'filter-onlyAvail' - a header with a select dropdown & this class name will only show available (visible) options within that drop down.
  • filter_reset : null - jQuery selector string of an element used to reset the filters.
  • filter_saveFilters : false - Uses the $ utility to save the most recent filters.
  • filter_searchDelay : 300 - typing delay in milliseconds before starting a search.
  • filter_serversideFiltering : false - if true, filter will be done server-side. The client-side filtering will be disabled, but the ui and events will still be used.
  • filter_startsWith : false - if true, filter start from the beginning of the cell contents.
  • filter_useParsedData : false - filter all data using parsed content.


Class names that can be added to the th header cells:
  • filter-false - disable the filter for a specific header column.
  • filter-select - build a default select box for a column (shows unique column content). See the custom filter widget demo for an example.
  • filter-match - applies to "filter-select" columns and columns where the user can use the logical "or" search. Makes the filter/select match the column contents instead of exactly matching.
  • filter-parsed - set a column to filter through parsed data instead of the actual table cell content.
  • filter-onlyAvail - show only available (visible) options within a default select box. See the custom filter widget demo "Discount" column for an example.


Set Filter Placeholder Text

Set a data-placeholder attribute on the associated table header with your desired placeholder text
<th data-placeholder="Enter Something">Name</th>
or, set the header cell's jQuery data
$('.tablesorter th:eq(0)').data('placeholder', 'Search for...')


Use the filterReset method to reset (clear) all of the current filters using this method


With this method, you can pass an array of filter values:
// apply "2?%" filter to the fifth column (zero-based index)
var columns = [];
columns[5] = '2?%';
// or define the array this way var columns = [ '', '', '', '', '', '2?%' ]
$('table').trigger('search', [ columns ]);
or, just pass false to refresh the current search:
$('table').trigger('search', false);
* Note: using this search method will update the contents of the filters within the filter row.

In v2.15, one additional parameter can be added to the array to perform an "any-match" of the table; Warning! please note that if no external input (with a data-column="all" is attached using bindSearch function) is visible, the user will not know that a filter has been applied.
// in a table with 4 columns; set the 5th parameter to any-match
$('table').trigger( 'search', [['', '', '', '', 'orange']] ); // find orange in any column

Get current filters

Get an array of the currently applied filters (v2.9).
$.tablesorter.getFilters( $('table') ); // or $('table.hasFilters')
This method returns an array of filter values or false if the selected table does not contain a filter row.

Internally, the get filters functions returns the filters stored within this table data $('table').data('lastSearch'), unless an additional parameter of true is passed to the function:
$.tablesorter.getFilters( $('table'), true ); // get current input values instead of data stored filters
As of v2.15, if an external "any-match" filter (see filter_external widget option) is included, one additional array parameter will be returned in the filter - the value of the any match search.
// in a table with six columns, this function will return an array with seven
// parameters; something like this: [ '', '', '', '', '', '', '11' ],
// where the "11" will be obtained from the "any-match" input
var filters = $.tablesorter.getFilters( $('table') );

Set current filters

Set the values of the actual filters using this method; include a true boolean to actually apply the search (v2.9).
// update filters, but don't apply the search
$.tablesorter.setFilters( $('table'), [ '', '', '', '', '', '2?%' ] );

// update filters, AND apply the search
$.tablesorter.setFilters( $('table'), [ '', '', '', '', '', '2?%' ], true );
This method returns true if the filters were sucessfully applied, or false if the table does have a filter row.

As of v2.15, if an external "any-match" filter (see filter_external widget option) is included, add an additional array parameter to set that filter; so if a table has six columns, add the any-match search as the seventh value.
// in a table with 6 columns, the 7th filter will apply
// to the any-match filter & match any table column with "11"
$.tablesorter.setFilters( $('table'), [ '', '', '', '', '', '', '11' ], true );

Bind External filter

Use this method to bind external search filters; include a data-attribute data-column with the column index to target, or use data-column="all" to preform an "any-match" search (v2.15). If no data-column is added to the input, the input will be ignored.
<!-- will perform an "any-match" type of search (matches any column) -->
<input type="search" class="search" data-column="all">
<!-- will only search the first column (zero-based index) -->
<input type="search" class="search" data-column="0">
// Target the $('.search') input using built in functioning
// this binds to the search using "search" and "keyup" and allows using filter_liveSearch
// or delayed search & pressing escape to cancel the search
// pass an optional third parameter (false boolean) to force the inputs to update
// this allows changing the data-column for an input dynamically 
$.tablesorter.filter.bindSearch( $table, $('.search'), false );
If you don't care about the enhanced search filter, then bind to both the "keyup" and "search" events
// Basic search binding, alternate to the above
// bind to search - pressing enter and clicking on "x" to clear (Webkit)
// keyup allows dynamic searching
$(".search").bind('search keyup', function (e) {
  $('table').trigger('search', [ [this.value] ]);


  • filterEnd - Event triggered when the filter widget has finished processing the search.
  • filterInit - Event triggered when the filter widget has finished initializing.
  • filterStart - Event triggered when the filter widget has started processing the search.


Moved to the wiki pages - filter change log.


filter_startsWith : false (if true, search from beginning of cell content only)
filter_ignoreCase : true (if false, the search will be case sensitive)
filter-match (if class name added to the "First Name" column, all "or" searches will only match the content; Search in the First Name column (2.10.1).
Search in the Discount column
Rank First Name ( filter-match ) Last Name Age Total Discount Date
1Philip Aaron WongJohnson Sr Esq25$5.9522%Jun 26, 2004 7:22 AM
11AaronHibert12$2.995%Aug 21, 2009 12:21 PM
12Brandon ClarkHenry Jr51$42.2918%Oct 13, 2000 1:15 PM
111PeterParker28$9.9920%Jul 6, 2006 8:14 AM
21JohnHood33$19.9925%Dec 10, 2002 5:14 AM
013ClarkKent Sr.18$15.8944%Jan 12, 2003 11:14 AM
005BruceAlmighty Esq45$153.1944%Jan 18, 2021 9:12 AM
10AlexDumass13$5.294%Jan 8, 2012 5:11 PM
16JimFranco24$14.1914%Jan 14, 2004 11:23 AM
166Bruce LeeEvans22$13.1911%Jan 18, 2007 9:12 AM
100Brenda DexterMcMasters18$55.2015%Feb 12, 2010 7:23 PM
55DennisBronson65$123.0032%Jan 20, 2001 1:12 PM
9MarthadelFuego25$22.0917%Jun 11, 2011 10:55 AM

Page Header

<!-- blue theme stylesheet -->
<link rel="stylesheet" href="../css/">
<!-- tablesorter plugin -->
<script src="../js/jquery.tablesorter.js"></script>

<!-- tablesorter widget file - loaded after the plugin -->
<script src="../js/jquery.tablesorter.widgets.js"></script>




/* This css is already contained within each theme file */
/* filter row */
.tablesorter-filter-row td {
  background: #eee;
  line-height: normal;
  text-align: center; /* center the input */
  -webkit-transition: line-height 0.1s ease;
  -moz-transition: line-height 0.1s ease;
  -o-transition: line-height 0.1s ease;
  transition: line-height 0.1s ease;
/* optional disabled input styling */
.tablesorter-filter-row .disabled {
  opacity: 0.5;
  filter: alpha(opacity=50);
  cursor: not-allowed;

/* hidden filter row */
.tablesorter-filter-row.hideme td {
  /*** *********************************************** ***/
  /*** change this padding to modify the thickness     ***/
  /*** of the closed filter row (height = padding x 2) ***/
  padding: 2px;
  /*** *********************************************** ***/
  margin: 0;
  line-height: 0;
  cursor: pointer;
.tablesorter-filter-row.hideme .tablesorter-filter {
  height: 1px;
  min-height: 0;
  border: 0;
  padding: 0;
  margin: 0;
  /* don't use visibility: hidden because it disables tabbing */
  opacity: 0;
  filter: alpha(opacity=0);

/* filters */
.tablesorter-filter {
  width: 95%;
  height: inherit;
  margin: 4px;
  padding: 4px;
  background-color: #fff;
  border: 1px solid #bbb;
  color: #333;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  -webkit-transition: height 0.1s ease;
  -moz-transition: height 0.1s ease;
  -o-transition: height 0.1s ease;
  transition: height 0.1s ease;



Next up: jQuery Any Match filter widget ››