Home > other >  Get Row Data from Data table having a column as input field
Get Row Data from Data table having a column as input field

Time:02-01

I have a datatable having a column with an input field. To get the data from table I'm using:

table.rows().data().toArray();

Im getting the result array, but for the column with input field I'm getting the whole html of input field and not just the value. eg. '<input type="text" value="someValue"></input>'

How can I manipulate the code to get the value of input in result Array. TIA.

CodePudding user response:

table
  .rows()
  .data()
  .toArray()
  .map((el) => {
   if(el.includes('<input')){
    return el.split('value="')[1].split('"')[0]
   }
  })
  •  Tags:  
  • Related