I have a table. Now I cloned it. when I am using the tablesorter it is saying cannot use it on a type object.
So, how can i cast it to object.
var clonedTable = $('#originalTable').clone();
$(clonedTable).tablesorter({
widgets: ['zebra'],
headers: {
0:{sorter:false},
1:{sorter:false},
2:{sorter:false},
3:{sorter:false},
4:{sorter:false} }
});
Here tablesorter is complaining that: uncaught type error. object[object object] has no method tablesorter
Edit:
Digging more into code… i notice the cause is this line:
var clonedTableRows= $('clonedTable tr:gt(0)');
looks like clonedTableRows is empty… Is my syntax wrong?
As @nbrooks said, the quotes shouldn’t be around the
clonedTablevariable. Try this instead:Also, you are initializing the plugin on a cloned object that isn’t attached to the DOM. Append the cloned table somewhere, then initialize the plugin: