I have a table and a class = Add that appends rows when clicked and a class = number.
My question is how can I append my rows with the number that stored in the span with class number?
Here is my snippet :
$(document).ready(function () {
$(".add").click(function () {
$('#mytable tr:last').after('<tr><td class="tr1" style="max-width: 10px;">Hello</td></tr>');
});
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>
You can add <span class="number"> 3</span> Hosts
<table id="mytable" border="1">
<tr>
<td>1</td>
<td>Title</td>
<td>price</td>
</tr>
<tr>
<td>1</td>
<td>Title </td>
<td>price</td>
</tr>
</table>
<span class="add" data-tooltip="You can add 3 host"><font color="red">add+</font></span>
<font color="red">is deprecated, please use CSS.