简体   繁体   中英

How to return an object of an element with javascript or jquery

For some of you the question might sound funny, but I would like to know how is possible to return an object of an element theough browser console so that I could see what methods are assigned to it.

Let's say if I am doing like this:

$('.smartmenufloaty')

it will bring an array of elements.

$('.smartmenufloaty')[0] 

this will bring up the HTML context of an element, but still not pretty sure what is the main difference of the array and of this HTML context, but what I am looking is how to reveal something like this through console:

[div.smartmenufloaty, context: div.smartmenufloaty, init: function, selector: "", jquery: "1.3.2", size: function…]

which holds the information I need. I would appreciate an explanation or a link where I could read more.

Thanks a lot.

Try

console.dir($('.smartmenufloaty')[0]);

http://jsfiddle.net/56DZe/

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