Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js html table extract data

const extractData = (tableId, mapper) => {
  const myTab = document.getElementById(tableId);
  if (myTab) {
    const data = [...myTab.rows].map((r) => [...r.cells].map((c) => c.innerText));
    return data.map(mapper);
  }
};

// Call the function and do whatever you want with the data
const data = extractData('target-table', (x) => ({
  name: x[0]
}));
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript degree to radians 
Javascript :: javascript modify url without reloading page 
Javascript :: how to update angular version 
Javascript :: edit json via nodejs 
Javascript :: pass only numbers in input react js 
Javascript :: jquery add div element 
Javascript :: passing data in react router history,push 
Javascript :: loop n times js 
Javascript :: refresh page after success ajax 
Javascript :: batch md 
Javascript :: how to use ionicons in react 
Javascript :: update table remove a key from json object mysql 
Javascript :: javascript split by newline 
Javascript :: set auto-hide toast javascrpt 
Javascript :: create random aleatory token javascript 
Javascript :: angular bootstrap not working 
Javascript :: how to find the width of outerconatiner in react native 
Javascript :: AppBridgeError shopify 
Javascript :: map onliy three object 
Javascript :: angular readonly/Disabled if value is not null 
Javascript :: block enter key using jquery 
Javascript :: jquery set title 
Javascript :: pattern cpf js 
Javascript :: javascript remove element from array 
Javascript :: breaking from a labeled while loop js 
Javascript :: verta sample jalali laravel problem return object json 
Javascript :: date of birth validation in yup 
Javascript :: unistall react node package 
Javascript :: make created element brighter 
Javascript :: js add delay 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =