JQuery CSS selector e.fn.e.init

Sometimes I use jquery to check my css. And often I use a simple selector (in the Chrome Web Developer console)

I will type something like $('.topclass div') and come back

 e.fn.e.init[125] 

As nodes containing a javascript object . (This is usually a pretty complicated selector, but sometimes a simple one).

Why am I getting this? Does this mean that the tag is missing or my selector is wrong?

Edit: html is basically nested divs (maybe because it gets its child divs too?)

+6
source share
1 answer

This means that your choice contains too many matches, and the developer tools reduce their presentation in the console.

Try this in the console:

 var a = [] for (var i = 0; i < 10; i++) { a.push('foobar'); } 

If you try to check a , you will see ["foobar", "foobar", "foobar", "foobar", "foobar", "foobar", "foobar", "foobar", "foobar", "foobar"] . Now add some more elements:

 for (var i = 0; i < 100; i++) { a.push('foobar'); } 

Now, if you try to check it, you will see Array[110] .

This does not mean that your selector is wrong, but if you expect fewer elements, this might be wrong.

+5
source

Source: https://habr.com/ru/post/916830/


All Articles