Question: how to get selected row data in datatable?
Answer: It can be useful to provide the user with the option to select rows in a DataTable. This can be done by using a click event to add / remove a class on the table rows. The rows(). data() method can then be used to get the data for the selected rows.