Restricting select to a specific div
I have a table and I want to find a specific row and move it to the end. I do that with this code:
- var failLegend = $(".jqplot-table-legend tbody tr").filter(function() {
- return $(this).text() == "GA Fails";
- }).closest("tr");
- failLegend.insertAfter($(".jqplot-table-legend tbody tr:last"));
That works fine as long as I have just one table. But I have multiple tables all with the same class, and I end up with all of the "GA Fails" rows from all the tables an the end of the last table (instead of one on each table). Each table is in its own div, and I can get at the div name from the $chart variable:
$chart
[
-
<div id="chart_0" style="width: 95%; height: 450px; position: relative; " class="jqplot-target">…</div>
But I can't figure out how to use that in my code so when I find and move the row, it only applies to the specific div in $chart.
So to summarize, in $chart there is table with class jqplot-table-legend, and I want to find the row in that table that has a value of "GA Fails" and make it the last row in the table. There may be other jqplot-table-legend tables in divs not included in $chart, and I don't want to do that to those tables - just the one that is part of $chart.