I'm trying to sort tr
but I've no luck by far.
Here is my tr
structure.
<tr>
<td>
<a href="./BlueSky-TexasHealthResources/index.php" >Blue Sky-Texas</a>
</td>
<td>
<a href="./BlueSky-TexasHealthResources/view.php">View Data</a>
</td>
<td id="blue_sky_texas">
</td>
</tr>
<tr>
<td id = 'bj'>
<a href="./BountyJobs/index.php" >Bounty Jobs</a>
</td>
<td>
<a href="./BountyJobs/view.php">View Data</a>
</td>
</tr>
Here is Javascript that I've tried by far.
<script type="text/javascript">
var $tr = $("tr");
$(document).ready(function () {
var alphabeticallyOrderedTr = $tr.sort(function (a, b) {
return $(a).find("a:first").text().toLowerCase().localeCompare($(b).find("a:first").text().toLowerCase());
});
$("#container").html(alphabeticallyOrderedTr);
});
</script>
And below is the image for table (unsorted using above code :( ).