Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

239
Views
Get meta value of td (React Js

Lets say I already have this <td meta="Special forces" >View</td> and I need to get meta. How can I get it? I am using react js and using document.getelementByTagName() is bit tricky. Advice please

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Since you're using React, you can make use of ref. Please find the below example which I've tried.

import { useEffect, useRef } from "react";

export default function App() {
  const ref = useRef();
  useEffect(() => {
    console.log(ref.current.getAttribute("meta"));
  });
  return (
    <div className="App">
      <table>
        <tbody>
          <tr>
            <td ref={ref} meta="Special forces">
              View
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  );
}

Try to look the code here in Sandbox here which I tried.

about 4 years ago · Juan Pablo Isaza Report

0

If you want to get every td element with meta attirbute, you can use querySelector with td[meta].

const elements = document.querySelectorAll('td[meta]');
console.log(elements);
<table><tr><td meta="Special forces" >View</td></tr></table>

btw, there is no meta attribute in td tag in HTML5.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!