How I fixed: “Uncaught TypeError: Object [object Object] has no method tablesorter”

/Camp — Free classes on all things Web in the Scottsdale, Arizona area (Ad)


Trying to get this Tablesorter plugin to work I did the following to fix it:

Okay, so this is what I did to fix this. First, I noticed that the plugin extends the $ functions, so I had to make sure and use (right way)

$(document).ready(function() { 
    $('#report').tablesorter(); 
});

Before, I was using this because I was using WordPress (wrong way)

jQuery(document).ready(function() { 
    jQuery('#report').tablesorter(); 
});

Then, I had to make sure that in they weren’t <td>‘s, but were <th>‘s

<table class="tablesorter" id="report">
        <thead>
            <tr class="head">
                <th class="id">ID</th>
                <?php foreach($definitions['report_fields'] as $field_key): ?>
                    <th>
                        <?php webfoots_e($definitions['fields'][$field_key]['label']); ?>
                    </th>
                <?php endforeach; ?>
            </tr>
        </thead>

Hope it helps!

Over @Stackoverflow

One thought on “How I fixed: “Uncaught TypeError: Object [object Object] has no method tablesorter””

  1. try to view source and then do ctrl+F and search for <script and go through each one. you should come across one jquery.js, a tablesorter.js, and then another jquery.js. you need to remove the third one.

Leave a Reply