简体   繁体   中英

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>

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM