How to insert new row to the end of table?, and how to make the button (that needs to hide the same row) display after check the checkbox??
I dont know how to call the element by name insted of id like I use too... i tried to search in the web but nothing was helpful.
- without change anything in the HTML ! *
$(function(){
console.log("Loaded")
$("tr").hover(function () {
$(this).css("background","#F8F8F8");
},function () {
$(this).css("background","");
});
$("#add").click(function() {
//something here??
});
});
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript" src="q2.js"></script>
<style>
.hidden {
display: none
}
</style>
</head>
<body>
<div id='main'>
<div id='button'>
<button id='add'>Add row</button>
<button id='hide' class='hidden'>Hide row</button>
</div>
<table>
<tr>
<td>
<input type='checkbox' name='row1'>
</td>
<td>First row</td>
</tr>
<tr>
<td>
<input type='checkbox' name='row2'>
</td>
<td>Second row</td>
</tr>
<tr>
<td>
<input type='checkbox' name='row3'>
</td>
<td>Third row</td>
</tr>
</table>
</div>
</body>
</html>