So I have this table and I have added some buttons inside the table cells
<table border="1">
<tr>
<th><button id="0" class="mybtn" >1</button><div class="myDiv"></div></th>
<th><button id="1" class="mybtn">2</button><div class="myDiv"></div></th>
<th><button id="2" class="mybtn" >3</button><div class="myDiv"></div></th>
</tr>
</table>
When I click on the buttons I want them to add a text field. But when I click on it all three buttons work at the same time.
Here is my jQuery code
$(document).ready(function() {
$(".mybtn").on("click",function() {
$(".myDiv").append("<div><br><input type='text' /><br></div>");
});
});
how to make the buttons work independetly?