Console shows javascript logging very fast and no time preview output

1

This is my code is a simple form:

<!DOCTYPE html>
<html>

<head>
    <title>Formulário</title>
    <meta charset="utf-8" />
</head>

<body>
    <form name="meu_form">

        <h1>Formulário</h1>

        <p class="nome">
            <label for="nome">Nome</label>
            <input type="text" id="nomeid" required="required" name="nome" />
        </p>

        <p class="fone">
            <label for="fone">Fone</label>
            <input type="text" id="foneid" name="fone" />
        </p>
        <p>
            <label for="email">Email</label>
            <input type="email" id="emailid" name="email" />
        </p>
        <p class="submit">
            <input type="submit" onclick="enviar()" value="Enviar" />
        </p>

    </form>
    <script type="text/javascript">
        function enviar() {

            var nome = document.getElementById("nomeid");
            var fone = document.getElementById("foneid");
            var email = document.getElementById("emailid");

            if (nome.value != "") {
               console.log('Obrigado sr(a) ' + nome.value +
                 ' os seus dados foram encaminhados com sucesso.\n'
                 +'Seus dados:\n'
                 +'Nome : '+ nome.value
                 +'\nFone '+ fone.value 
                 +'\nEmail '+ email.value);
            }

        }
    </script>
</body>

</html>

If I replace the console with the alert it works fine, but I want to use the console.

The problem is that when I want to see the output on the browser console Chrome (I have not tested on others) it is displayed so fast that it does not read.

What should I do?

    
asked by anonymous 26.10.2017 / 16:03

1 answer

4

To keep the console in Google Chrome you should follow these steps:

  • Press f12 on your keyboard to open the developer tools.
  • In the Console tab there is a small gear on the right side, click on it.
  • Once this is done, several settings will appear, check the Preserve log
  • The console should already be preserved.
26.10.2017 / 16:42