ahmed salah

ahmed salah

  • NA
  • 530
  • 149.8k

Delete button no responding and not remove record

Jul 20 2016 1:56 PM
I try more time to delete record by jquery but no responding meaning nothing happen
my code as following
 
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
<script src="~/Scripts/jquery-1.10.2.js"></script>
<script>
$(function () {
$("#btn").click(function ()
{
var x = $("#txt1").val();
var y = $("#txt2").val();
var z = $("#txt3").val();
$("#tb").append("<tr> <td>" + x + "</td> <td>" + y + "</td> <td>" + z + "</td><td> <input type='button'value='Delete'/></td><td> <input type='button'value='Edit'/></td></tr>");
});
$("#tb").on("click", ".c", function () {
$(this).parent().parent().remove();
});
});
</script>
</head>
<body>
<div>
ID<input type="text" id="txt1" /><br />
Name<input type="text" id="txt2" /><br />
Country<input type="text" id="txt3" /><br />
<input type="button" value="add" id="btn" />
<table id="tb">
<tr><td>ID</td><td>Name</td><td>Country</td><td><input type="button" class="c" value="Delete" /></td><td>Edit</td></tr>
</table>
</div>
</body>
</html>
what remaining in my code or wrong to button delete work 
 

Answers (1)