Get the Value of Input Text within table cell
Get the Value of Input Text within table cell
Consider the following Data Tables Snippet on Data Tables Live.
Basically I have a button that dynamically adds rows to the table using row.add
. The only twist is it adds html form element input box as second column using the code table.row.add(['blah', '<input type=text>']).draw(false);
Now there is a second button below the table that logs all of tables data to the console using console.log(table.rows().data())
This gives a two dimensional array in the console, but the second column has empty input boxes, no matter what value I put in the text boxes.
My question:
How do I get the value of input boxes which have been added dynamically to the table
Answers
Thank you, I solved this by adding a unique id to each input box and fetching it using jquery val() method.
Thanks for DataTables - It has really made my programming experience so much better.