sign-ptk

1. jquery对象分为两种,一种是dom对象,dom对象会自带一个length属性,所以这种情况:

  obj.length == 0

可以判断对象为空

2. jquery也可以自定义对象,如 var obj = {},这种情况定义的对象不会有length属性,

  则需要使用jquery方法:   $.isEmptyObject()

  if($.isEmptyObject(obj) == true){

    console.log("对象为空");

  }else{

    console.log("对象非空");

  }

分类:

技术点:

相关文章:

  • 2021-11-28
  • 2022-12-23
  • 2021-11-27
  • 2021-10-19
  • 2022-01-13
  • 2022-01-06
  • 2021-10-12
  • 2021-05-22
猜你喜欢
  • 2021-11-07
  • 2021-09-24
  • 2021-06-14
  • 2021-07-18
相关资源
相似解决方案