How to get data from controls within row?
How to get data from controls within row?
bnlprsd
Posts: 1Questions: 1Answers: 0
I am adding rows dynamically to datatable which contains textbox control. I need to get the data entered by user in the textbox. I am able to iterate the rows using DataTable.data() method and able to get the input control. But I am not getting the value. This is how I tried
var dt = $("#dGroupTable").DataTable();data().each(function () { //iterate each row
console.log($($(this)[0][0]).val()); });
This discussion has been closed.
Answers
Don't use
data()
since that will get the cached value from the cells that DataTables holds, rather than a live DOM value (because that is slow).Instead use
rows().nodes()
to get thetr
elements and then jQuery to get the inputs - e.g.Allan