Hi i have table have two buttons edit and delete
i need by jquery make edit to this tables meaning show textboxes inside table to edit
the ID,Name,Country
my code as following
@{
Layout = null;
}
<!DOCTYPE html>
<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'class='c' 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><input type="button"value="Edit" /></td></tr>
</table>
</div>
</body>
</html>
What i need to make function to edit id,name,country and show as text boxes to edit it
i need by jquery make edit to this tables meaning show textboxes inside table to edit
the ID,Name,Country
my code as following
@{
Layout = null;
}
<!DOCTYPE html>
<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'class='c' 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><input type="button"value="Edit" /></td></tr>
</table>
</div>
</body>
</html>
What i need to make function to edit id,name,country and show as text boxes to edit it