Sort Table Functionality

Today, I learned about how to create a table and include a 'sort' functionality. This is made possible with the inclusion of a jquery plugin called 'Tablesorter'.

Tablesorter is a very helpful Jquery plugin that turns a standard HTML table with THEAD and TBODY tags into a sortable table without the need to have any page refresh. To make the table sortable, you just need to include THEAD and TBODY tags in your table and reference the files. The script takes care of the rest.

In the table below, I have created a table of 15 rows and 7 columns using chatGPT. If you click the table headers, the table gets sorted accordingly.

Category Statistic 2024 Value 2023 Value Change (%) Source Notes
Total US Population People 340 million 338 million +0.6% Census Bureau Estimated
Net Migration People 2.8 million 1.9 million +47.4% Census Bureau Largest in 23 years
Green Cards Issued People 1.2 million 1.1 million +9.1% USCIS Legal Permanent Residents
Employment-Based Green Cards People 450,000 400,000 +12.5% USCIS Job-based visas
Family-Based Green Cards People 600,000 580,000 +3.4% USCIS Family reunification
Refugees Admitted People 125,000 100,000 +25% State Department Annual cap met
Asylum Applications Applications 500,000 420,000 +19% USCIS Pending backlog
H-1B Visas Issued People 85,000 85,000 0% USCIS Quota reached
Student Visas (F1) People 500,000 450,000 +11.1% State Department Higher education
Illegal Border Crossings Encounters 2.2 million 2.4 million -8.3% CBP Southwest border
Deportations People 250,000 200,000 +25% ICE Removals increased
Naturalizations People 900,000 850,000 +5.9% USCIS New US citizens
DACA Renewals Applications 600,000 700,000 -14.3% USCIS Program uncertainty
Work Permits Issued Permits 1.5 million 1.4 million +7.1% USCIS Temporary and permanent
Temporary Protected Status (TPS) Beneficiaries People 600,000 500,000 +20% USCIS Humanitarian protection

File Info

Category HTML / JS / CSS / JQUERY
Credits Rob Garrison
Date February 11th, 2025
Codepen NA