I have the following code:
<table id="Product">
<thead>
<tr>
<th>ProductId</th>
<th>Productname</th>
<th>Quantity</th>
<th>UnitPrice</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<button id="add" data-table="Product" data-url="Product/Add"></button>
Then in javascript file:
$('#add').click(function () {
var url = $(this).attr("data-url");
var table = $(this).attr("data-table");
var tableBody = ???;
//some logic with tablebody
});
How can i get table body of the table?
var tableBody = $("table tbody")orvar tableBody = $("#" + table)What is expected result?