After adding row cell in table not converted to textbox issue
Hi I need after i add row convert all cell found in row converted to text box
in code below i can add row success but i cannot converted all celles in row to text box
i try to make row added as text box but not got
my code as below
- @{
- 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();
- var M = $("#txt4").val();
- $("#tb").append("<tr> <td>" + x + "</td> <td>" + y + "</td> <td>" + z + "<td>" + M + "</td></tr>");
-
- });
- $("#tb").on("click", ".d", function () {
- var row = $(this).closest('tr').toggleClass("editing");
- row.find("td").slice(0, 3).prop("contenteditable", true);
- });
- });
- </script>
- <style>
- .editing {
- background: yellow;
- }
- </style>
- </head>
- <body>
- <div>
- Name<input type="text" id="txt1" /><br />
- Salary<input type="text" id="txt2" /><br />
- Bonus<input type="text" id="txt3" /><br />
- Deduction<input type="text" id="txt4" /><br />
- <input type="button" value="add" id="btn" />
-
- <table>
- <thead>
- <tr>
- <td>
- Name
- </td>
- <td>
- Salary
- </td>
- <td>
- Bonus
- </td>
- <td>
- Deduction
- </td>
- </tr>
- </thead>
- <tbody id="tb" class="d"></tbody>
- </table>
- </div>
- </body>
- </html>