I am creating one row every time im clicking on the btn Add row. In this row there is 3 textboxes and one lable(span) and one buttom. I want to reach by selector the value in the (input type:text) or the lable using the button in the created row (save projekt) to save this value in my Sharepoint hosted list. How can I do that please.
This is my HTML code
<div class="content">
<table id="Table">
</table>
</div>
<button type="button" onclick="add()">Add row</button>
This is my jquery code
function add() {
$("#Table").append("<tr class=\"tr\">" +
"<td><input type=\"text\"></td>" +
"<td><input type=\"text\"></td>" +
"<td><input type=\"text\"></td>" +
"<td><span \" class=\"lblStatus\"></span></td>" +
"<td><button type=\"button\" class=\"saveProjekt\">Save projekt</button></td>" +
"</tr>").trigger("create");
}
$(document).on("click", ".saveProjekt", function (e) {
var x1 = $(e.target).parent().parent().children("td .input:nth child(1)").val();
var x2 = $(e.target).parent().parent().children("td .input:nth child(2)").val();
alert(x1);
alert(x2);
})