HOME > > > > >

jQuery.isPlainObject(object)

引数

object
判定したいオブジェクト

戻り値

boolean
判定結果

objectがObjectコンストラクタかリテラルで生成されたものならtrueそれ以外はfalseとなります。

サンプル

実行結果

Javascript

  1.  
  2. var obj_1 = {test: 'test'};
  3. var obj_2 = new Object();
  4.  
  5. var obj_3 = 12345;
  6. var obj_4 = 'string';
  7.  
  8. $('.jqTest').html(
  9.     '$.isPlainObject(obj_1) => ' + $.isPlainObject(obj_1) + '<br />' +
  10.     '$.isPlainObject(obj_2) => ' + $.isPlainObject(obj_2) + '<br />' +
  11.     '$.isPlainObject(obj_3) => ' + $.isPlainObject(obj_3) + '<br />' +
  12.     '$.isPlainObject(obj_4) => ' + $.isPlainObject(obj_4)
  13. );

HTML

  1. <div class="jqTest">
  2. </div>