Here is a little JavaScript snippet to run in a browsers console – I created this to a form and lists the ids of all the form elements (so I could do things with them in PHP)
var temp;
$(':input').each(function () {temp += "'" + ($(this).attr('id')) + "',"});
temp;
It declares a global variable, finds all the elements and appends their id’s along with quotes into the variable and finally displays the contents in the browser console.