accessing table with a certain class within a certain div id where div id is in a variable
I want to access a table with a certain class and prepend something to the table. But there are many of these tables each in its own div with a unique id. I can get all the tables like this:
- $("table.table-class").each(function() {
- $(this).prepend(...);
- });
But I only want to prepend to one table that is in a div I have in a variable:
- $chart
- [<div id="chart_0" style="width: 95%; height: 450px; position: relative;">…</div>
How can use that $chart variable to get at just its
table.table-class and do the prepend just on that?