Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

81
Vistas
JS HTML Disappearing

I am writing a script that inserts following html on the page

function showBut(){
    if ($('div.content-title > h4').size() > 0 && $('#calculate').size() < 1){
        const button = `<button id="calculate" style="cursor: pointer;">Calculate</button>
                        <button id="finalAmount" style="cursor: pointer;font-size: 14px;"></button>
                        <button id="linkPaste" style="cursor: pointer;font-size: 14px;"></button>`;
        $('div.content-title > h4').append(button);
    //alert("done");
    $('#calculate').click(getPrice);
    $( "#finalAmount" ).click(function() {
  navigator.clipboard.writeText($("#finalAmount").text());
});
    $( "#linkPaste" ).click(function() {
  navigator.clipboard.writeText($("#linkPaste").text());
});

}
}

window.addEventListener("load", function(){
    // ....
     'use strict';
    showBut();

    
});

The inserted html shows for a brief moment and disappears. If I keep reloading, sometimes it'll stay, but mostly it disappears.

How can I fix this?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda