小白教程
所有教程
关于
Search
108.162.216.106
108.162.216.106
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Misc size”的源代码
本页内容
上一节:
Misc_removedata
下一节:
Misc_toarray
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:size()}}[[Category:jquery ref misc|8]] = jQuery 杂项 size() 方法 = [[jquery ref misc|jQuery 杂项方法]] 输出被 jQuery 选择器匹配的元素的数量: <sample title="" desc="" lang="html" hererun="1"> $("button").click(function(){ alert($("li").size()); }); </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").size()); }); }); </script> </head> <body> <button>输出li元素的数量</button> <ul> <li>Coffee</li> <li>Milk</li> <li>Soda</li> </ul> </body> </html> </run> == 定义和用法 == size() 方法在 jQuery 版本 1.8 中[javascript:NewWindow('/try/deprecated.htm') 被废弃]。 请使用 [[prop length|length]] 属性代替。 size() 方法返回被 jQuery 选择器匹配的元素的数量。 == 语法 == $(selector).size() [[jquery ref misc|jQuery 杂项方法]]
返回至“
Misc size
”。
上一节:
Misc_removedata
下一节:
Misc_toarray