How many elements were selected by jQuery

Recently I needed to find out how many elements were selected by jQuery. jQuery selector returns an array of elements jQuery object that has .length attribute. So the easiest way is to get the length of returned jQuery object. The size of that object will be equal to the number of selected elements. $('.someClass').length;

// Assume you have 4 .class elements
$('.class').length;
// would return

Comments

Popular posts from this blog

Types and forms of imitation gemstone and manufactured

Genuine Windows 7 Ultimate: The GENUINE Windows 7 activator for x32 and x6480

7 Tips before you buy detectors for gold and treasures and minerals