这是什么意思:"jQuery('> li',this)'" [英] what does this mean: "jQuery('> li', this)"

查看:73
本文介绍了这是什么意思:"jQuery('> li',this)'"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚这个jQuery插件的工作方式: http://codeasily.com/jquery/multi-column-list-with-jquery

I'm trying to figure out how this jQuery plugin works: http://codeasily.com/jquery/multi-column-list-with-jquery

在插件的开头有这一行:

In the plugin there is this line at the beginning:

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

我知道

ul > li

表示:表示选择所有直接父为ul的li.但是> li"是什么意思?我跑了:

means: it means select all li whose direct parent is a ul. But what does '> li' mean? I ran:

$('> li')

但它返回

[]

即使页面上有很多嵌套的无序列表HTML.

even though I have plenty of nested unordered list HTML on the page.

推荐答案

请勿使用.文档建议您不要使用,因为它将很快被弃用.

Don't use it. The docs advise that you shouldn't use at as it will be soon deprecated.

来自 http://api.jquery.com/child-selector/

注意:在以后的版本中,将不推荐使用$("> elem", context)选择器.因此,建议不要使用它来代替使用替代选择器.

Note: The $("> elem", context) selector will be deprecated in a future release. Its usage is thus discouraged in lieu of using alternative selectors.


但是要回答,它有效地使用了从中调用选择器的元素作为 child-selector 的左手操作数.


But to answer, it effectively uses the element(s) from which the selector is called as the left hand operand of the child-selector.

这篇关于这是什么意思:"jQuery('> li',this)'"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆