jQuery API

jQuery.isPlainObject()

jQuery.isPlainObject( object ) Returns: Boolean

Description: Check to see if an object is a plain object (created using "{}" or "new Object").

  • version added: 1.4jQuery.isPlainObject( object )

    objectThe object that will be checked to see if it's a plain object.

Example:

Check an object to see if it's a plain object.

jQuery.isPlainObject({}) // true
jQuery.isPlainObject("test") // false

Comments

  • Support requests, bug reports, and off-topic comments will be deleted without warning.

  • Please do post corrections or additional examples for jQuery.isPlainObject() below. We aim to quickly move corrections into the documentation.
  • If you need help, post at the forums or in the #jquery IRC channel.
  • Report bugs on the bug tracker or the jQuery Forum.
  • Discussions about the API specifically should be addressed in the Developing jQuery Core forum.
  • LorenW
    Why is a function like this important? A short use case would be helpful. I don't want to miss out on the usefulness of any of the new functions!
  • build_your_web
    "The object that will be checked to see if it's an object literal."
    - if it's a plain object.
  • Replace 2 "isObjectLiteral" with "isPlainObject".
  • Good catch, fixed.
  • Not yet. One more to go :)
  • fixed.