jQuery.isPlainObject()Method

jQuery 杂项方法jQuery Miscellaneous Methods

Example

Determine whether an object is a plain object.

$(function () { function fun( html ){ document.body.innerHTML += "<br>" + html; } fun($.isPlainObject({})); //true fun($.isPlainObject( "test" )); //false fun($.isPlainObject(document.location)); //false, returns true in IE 8 })

Try it Yourself »

Definition and Usage

The $.isPlainObject() function is used to determine whether the specified argument is a plain object.

Note:Host objects (or other objects used by the browser host environment to complete the ECMAScript execution environment) are difficult to perform cross-platform feature detection. Therefore, for instances of these objects, $.isPlainObject() may produce different results in different browsers.


Syntax

$.isPlainObject( object )

Parameter Description
object Any type Any value that needs to be determined.


jQuery 杂项方法jQuery Miscellaneous Methods

Other extensions