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

174
Visualizações
jQuery Insert .after() is inserting as a string not HTML

I have my element selected like so

let btn = $("a[translate='server.ipmi.kvm.LAUNCH']")[0];

Then when attempting to insert after it i'm doing the following

btn.after('<a class="btn btn-default" onclick="launchNewKvm()">New KVM</a>')

This is inserting the content as a string for some reason and not as a button as I'd like, If I wrap this as a jQuery element then it inserts as [object Object]

any ideas at all would be appreciated

Inspect Element after running the .after

almost 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Here you use after method of javascript, not jquery, which if you need to insert an HTML, it should be a DOM Node or it will be treated as text.

If you want to use jquery after method, then don't get the index

let btn = $("a[translate='server.ipmi.kvm.LAUNCH']");

btn.after('<a class="btn btn-default" onclick="launchNewKvm()">New KVM</a>')
almost 4 years ago · Santiago Trujillo 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