How to check object is empty or not in jQuery

Updated at 31-Jul-2021, By samar

How to check object is empty or not in jQuery

Through many examples, we will learn how to resolve the "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.
  • JQuery $.isEmptyObject() method

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

    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