jenda
jenda

Reputation: 156

jQuery console.log() doesn't work in Firefox

I'm working in jQuery 3.1.0 and I want to use the console.log() function to debug my code (I use the default developer console in Firefox 47.0).

I tried the following code:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script>
    $(document).ready(function(){
        console.log($("body").height());
        alert($("body").height());
    });
</script>

(The <script> elements are in the <body> element (at the end, just before </body>.)

When trying to run the page, I get the alert with the correct number, but the console is empty. When i tried to type in console.log('foo'); into the command line, it responds undefined:

screenshot here

(I'm sorry for my terrible English.)

Edit: I now tried with the following code, but it still doesn't seem to work:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
    </head>
    <body>
        <script>
            console.log('hi');
        </script>
    </body>
</html>

Upvotes: 2

Views: 2759

Answers (1)

Jesus Gonzalez
Jesus Gonzalez

Reputation: 411

You must enable Zurnal option (grey circle) in the top tab where CSS, JS, ... in the developer console.

Else, you will not get log output.

In spanish is Registro. In english it will be something like Registry/Logs.

Upvotes: 6

Related Questions