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

158
Visualizações
JavaScript on Website can't "select" element

i recently started reworking my website, mainly adding features or rewriting code. Now, I wanted to add a socials-page (with my social-media links) and i want my JavaScript to import the cards from a JSON-document. For that, i need to select the socialsTitle, socialsLink, socialsLinkDisplay and socialsIcon-elements to put in their values. For selecting those elements. I did this, but the only element that's just returning null is the socialsLink.

JS:

const socialsTitle = socialsCard.querySelector("[socialsTitle]");
const socialsLink = socialsCard.querySelector("[socialsLink]");
const socialsLinkDisplay = socialsCard.querySelector("[socialsLinkDisplay]");
const socialsIcon = socialsCard.querySelector("[socialsIcon]");

HTML:

<template socialsTemplate>
    <a target="_blank" class="card socialsElement" socialsLink>
        <img alt="" class="appIcon socialsElement" socialsIcon />
        <h1 class="appDetails socialsElement">
            <p class="appName socialsElement" socialsTitle></p>
            <p class="appLink socialsElement" socialsLinkDisplay></p>
        </h1>
    </a>
</template>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I believe socialsCard is the element having socialsLink attribute. querySelector is for looking up children nodes within the element you call it on.

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