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

158
Visualizações
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 Respostas
Responde à pergunta

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 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