We help IT Professionals succeed at work.

javascript, jquery, table

http://www.kryogenix.org/code/browser/sorttable/

I have used above js for my html table. It works fine until I add one extra thead
like the following. After I added 'thead', the sorting feature is no longer available.
any experts can help?

Thanks

<table>
<thead>
<tr><td>....</td></tr>
</thead>
<thead>
<tr><td>....</td></tr>
<thead>
<tbody>
<tr><td>...</td></tr>
</tbody>
</table>
Comment
Watch Question

Commented:
I am not familiar with that script, however it may be a typo in your 'pseudo' code you pasted....but I see you are not closing your <thead> tags....

 <table>
<thead>
<tr><td>....</td></tr>
</thead>
<thead>
<tr><td>....</td></tr>
<thead> <!-- was this meant to be closed? ie: </thead> -->
<tbody>
<tr><td>...</td></tr>
</tbody>
</table>

Open in new window

Author

Commented:
why don't you just download the file and add the codes...yes it is missing the </thead>
you can add it and try and see it works or not.

Commented:
Downloading the script wouldn't mean a thing if your markup is bad.

With your example post, your markup was bad.  

Please post your code, otherwise we have nothing to go off of.

Commented:
It looks like you should only have one <thead> element.
Project Architect
CERTIFIED EXPERT
Commented:
'sorttable' will not work if there are two or more rows inside the <thead>,
'sorttable' does work if there are two <thead> definitions ... only the first <thead> will be 'clickable' to perform sorts ... the second <thead> is ignored.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.