jQuery get all ids on page

jquery

Solution

You could do this:

var ids = new Array();
$('[id]').each(function() { //Get elements that have an id=
  ids.push($(this).attr("id")); //add id to array
});
//do something with ids array

One note I saw testing this, the FireBug console counts as one, if that's enabled just be aware.

Problem

Is it possible to get an array consisting of all id's on a page with jQuery?

Original source