How to view DOM element when console.log jquery object in webkit

13,553

This should do it for you:

console.log($('body')[0]);

The reason being jQuery wraps elements in an array, so you need to access the actual element via an array index.

Or click the little triangle to the left to expand the output so that you can interact with the elements that are printed out.

Share:
13,553
Globalz
Author by

Globalz

Updated on June 08, 2022

Comments

  • Globalz
    Globalz almost 2 years

    Used to be able to perform a console.log on a jQuery object and Chrome would output the corresponding DOM element like the Elements Tab.

    Now it does this:

    console.log($('body'));
    [<body>, context: #document, selector: "body"]
    

    If you leave out the console.log, and type directly into the console you can get the old behavior:

    $('body')
    [<body>​…​</body>​]
    

    This is what I want! How do I get it back so I log jQuery objects programmtically and have them return live DOM objects like the elements Tab?