Latest web development tutorials

jQuery.isEmptyObject() 方法

jQuery 雜項方法 jQuery雜項方法

實例

返回數組中指定元素的索引值

$ ( function ( ) { function fun ( html ) { document . body . innerHTML += " <br> " + html ; } fun ( $. isEmptyObject ( { } ) ) ; // true fun ( $. isEmptyObject ( { foo : " bar " } ) ) ; // false } )

嘗試一下»

定義和用法

$.isEmptyObject() 函數用於檢查對像是否為空(不包含任何屬性)。


語法

$.isEmptyObject( object )

参数 描述
object object类型 需要进行判断是否为空的对象。


jQuery 雜項方法 jQuery雜項方法