TableSort JQuery not working with dynamic Rails Table

Dear All,

I am trying to use Table sort Jquery plugin to sort my table in Rails application by clicking Table header. But it is not working.I added

<%= javascript_include_tag ‘jquery.js’%>

<%= javascript_include_tag ‘jquery.tablesorter.js’%> in my layout…

Here is my Code,

Listing books

<thead>
</thead>

<% @books.each do |book| %>

<tbody>
</tbody>

<% end %>

Title

Author

<%=h book.title %>

<%=h book.author %>


<%= link_to ‘New book’, new_book_path %>

Help me pals…

Move outside loop, and then check.