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

95
Visualizações
Getting an appended href link with jquery

I am trying to get a link from an appended element.

The link is appended like so:

var imdbPointer = "https://www.imdb.com/title/" + data.imdb_id
imdbLink.empty()
imdbLink.append("<a href='" + imdbPointer + "'>" + "IMDB - " + data.original_title  + "</a>")

This essentially generates an imdb link for me. I was previously using

var storeIMDBLink = $( "a" ).attr( "href") This code successfuly got me the link when it was the only href one the page, however it grabs the first href it finds.

How can I grab a specific href link from this appended element?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Managed to get there with some hackiness.

var storeIMDBLink = $(this).parent().siblings('#imdb-link').children().attr( "href")

Both the imdb link and button that stored it were appended to the same UL

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