小白教程
所有教程
关于
Search
172.69.59.161
172.69.59.161
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Misc type”的源代码
本页内容
上一节:
Misc_trim
下一节:
Misc_unique
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:$.type()}}[[Category:jquery ref misc|36]] = jQuery.type()方法 = [[jquery ref misc|jQuery 杂项方法]] 该参数是否一个正则表达式 <sample title="" desc="" lang="html" hererun="1"> 这是一个正则表达式? <b></b> <script> $(function () { $( "b" ).append( "" + jQuery.type( /test/ ) ); }) </script> </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> </head> <body> 这是一个正则表达式? <b></b> <script> $(function () { $( "b" ).append( "" + jQuery.type( /test/ ) ); }) </script> </body> </html> </run> == 定义和用法 == $.type() 函数用于确定JavaScript内置对象的类型,并返回小写形式的类型名称。 如果对象是undefined或null,则返回相应的"undefined"或"null" <pre> $.type( undefined ) === "undefined" $.type() === "undefined" $.type( window.notDefined ) === "undefined" $.type( null ) === "null" </pre> 如果对象有一个内部属性[[Class]]和一个浏览器的内置对象的 [[Class]] 相同,我们返回相应的 [[Class]] 名字。 <pre> $.type( true ) === "boolean" $.type( 3 ) === "number" $.type( "test" ) === "string" $.type( function(){} ) === "function" $.type( [] ) === "array" $.type( new Date() ) === "date" $.type( new Error() ) === "error" // jQuery 1.9 新增支持 $.type( /test/ ) === "regexp" </pre> == 语法 == $.type( obj ) {| class="table table-striped table-hover" ! 参数 ! 描述 |- | obj | 任意类型 需要确定类型的任意对象。 |} [[jquery ref misc|jQuery 杂项方法]]
返回至“
Misc type
”。
上一节:
Misc_trim
下一节:
Misc_unique