Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery.isPlainObject() method

jQuery.isPlainObject() method

jQuery Miscellaneous MethodsjQuery Miscellaneous Methods

Example

Determine whether an object is a plain object.

$

(

function

(

)

{

function

fun

(

html

)

{

document

.

body

.

innerHTML

+=

"


"

html

;

}

fun

(

$.

isPlainObject

(

{

}

)

)

;

//

true

fun

(

$.

isPlainObject

(

"

test

"

)

)

;

//

false

fun

(

$.

isPlainObject

(

document

.

location

)

)

;

//

false, returns true in IE 8

}

)

Try it »


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 feature-detect across platforms. Therefore, for instances of these objects, $.isPlainObject() may produce different results in different browsers.


Syntax

$

.isPlainObject( object )

Parameters Description
object Any type: The arbitrary value to be checked.

jQuery Miscellaneous MethodsjQuery Miscellaneous Methods