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

155
Vistas
How to fadeIn text stored in a variable when clicking a button, using jQuery

I am trying to fadeIn some text which is stored in a variable that I want to show when a button is clicked. The code below works for the showing part but I can't figure out how to make it fadeIn.

<!DOCTYPE html>
<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <title>Fade in text example</title>
</head>
<body>  

    <div><button id ="button">Click to show text</button></div><br />
    <div id="txtDiv"></div>

    <script>
        $(document).ready(function(){
            var txt = 'Show this stored text.';
            $('#button').on('click', function() {
                $('#txtDiv').text(txt);
            });
        });
    </script>

</body>
</html>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

<script>
    $(document).ready(function(){
        var txt = 'Show this stored text.';
        $('#txtDiv').hide();
        $('#button').on('click', function() {              
          $('#txtDiv').text(txt);
          $('#txtDiv').fadeIn( 600 );
        });
    });
</script>
about 4 years ago · Juan Pablo Isaza Denunciar
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