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

156
Visualizações
$(this).attr("id") is returning as undefined inside of a click function
const chapterButtons = $(".chapter-button");

chapterButtons.each(() => {
    $(this).click(() => {
        window.location.href = "reading-page.html";
        let chptNum = parseInt($(this).attr("id"));
        sessionStorage.setItem("chptNum", chptNum);
    })
})

The $(this).attr("id") is undefined for all elements even though each element certainly has an id along with the .chapter-button class. I think there is some issue with using $(this) and it is not what I think it is. However, I'm not sure what it should be. I couldn't find someone else having this exact same issue.

Any help would be much appreciated!

about 4 years ago · Juan Pablo Isaza
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