小白教程
所有教程
关于
Search
172.71.254.227
172.71.254.227
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Prop length”的源代码
本页内容
上一节:
Prop_jquery_support
下一节:
Prop_cssnumber
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:length}}[[Category:jquery ref prop|6]] = jQuery length 属性 = [[jquery ref prop|jQuery 属性]] 输出 <li> 元素的数目: <sample title="" desc="" lang="html" hererun="1"> $("button").click(function(){ alert($("li").length); }); </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ alert($("li").length); }); }); </script> </head> <body> <button>输出li的数量</button> <ul> <li>Coffee</li> <li>Milk</li> <li>Soda</li> </ul> </body> </html> </run> == 定义和用法 == length 属性包含 jQuery 对象中元素的数目。 == 语法 == <pre> $(selector).length</pre> [[jquery ref prop|jQuery 属性]]
返回至“
Prop length
”。
上一节:
Prop_jquery_support
下一节:
Prop_cssnumber