I am in the process of updating my site to jQuery 1.7 with plans to update to the latest version as a phase 2. Below is my existing livequery code that I need to update to .on() in order to maintain the table sorting functionality.
// EXISTING CODE - Applies table sorting to existing and future tables with class of tablesorter
$("table.tablesorter").livequery(function(){ // need to replace this .livequery code
I can use this code to enable table sorting on tables that exist when DOM has loaded, but it will not work on tables created after DOM is loaded.
// Only works on existing tables
$('table.tablesorter').tablesorter();
I tried the following code with .on but it does not respond to the first click
// Works on existing tables and tables created later, but it will not respond to initial click event
$(document).on('click', 'table.tablesorter', function(e){ $('table.tablesorter').tablesorter(); });
Any recommendations will be greatly appreciated.