Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

242
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda