How to check object is empty or not in jQuery

You can easily check the the declared object is empty or not in jQuery by using $.isEmptyObject() method in jQuery.

Answers 1
  • JQuery $.isEmptyObject() method

    <script> 
    if($.isEmptyObject(data.success)){
        console.log('Is empty object');
    } 
    </script>
    
    0

    You can easily check that the object is empty or not in html using the jquery method $.isEmptyObject(). It will return true if data is an empty object.

  • Back to code snippet queries related jquery