li', this)" I am trying to understand how this jQuery plugin works: http://codeasily.com/jquery/multi-column-...">

What does this mean: "jQuery ('> li', this)"

I am trying to understand how this jQuery plugin works: http://codeasily.com/jquery/multi-column-list-with-jquery

In the plugin, this line starts from the beginning:

 if(jQuery('> li', this)) {

I know that

ul > li

means: this means selecting all li whose direct parent is ul. But what does li mean? I ran:

$('> li')

but he returns

[]

although I have many nested unordered HTML pages per page.

+5
source share
6 answers

Do not use it. The docs say you shouldn't use them, as this will be obsolete soon.

From http://api.jquery.com/child-selector/

. $("> elem", context) . , , .


(), .

+6

jQuery - .

jQuery('> li', this)

, :

jQuery(this).find('> li')
+5

, $(this).children('li'). : " this (> li)".

+3

jsut ul > li, , ul , this. , , this , , > li to.

, :

var ele = $('ul#someId');
var list = $('> li', ele);


var list2 = $('ul#someId > li');

// list is the same as list2
+1

It will look for the element liin immediate children within the element this, where it thiscan be a jQuery object or a DOM element.

+1
source

The selector searches for any immediate children <li>in the context of the thisDOM element

+1
source

All Articles