I store key-value pairs in a div container using:
$( '#div_id').data( key, value);
In the end, I need to check if anything is stored in this div container.
So first, I get the content by calling:
var data = $( '#div_id').data();
Then, to check its size with data.length or data.size.
But both functions do not exist. Since I know that the data function in jquery returns an object, so I should be able to get the size of this object.
How to get the size of an object returned by a data function in jquery?
source
share