Rather than stumble through it (with my limited understanding), please explain what is happening to (and the use of) the head var in the following 3 lines of code.
<script type="text/javascript">
var head = $("thead#tHead1").clone().removeAttr("class");
$(head).find("#hRow2").remove();
head = $(head).wrap("<thead>").parent().html();
Edit
What is the significance of using $(head) on the 2nd line of code, after setting head = on the 1st and then assigning head to another value?
See answers for what I learned.
$(head)in 3rd line.<thead>elements don't belong within other<thead>elements.