My code looks like this:
- Link 1
<
var ids = new Array(); var hrefs = new Array(); $('#ulList li').each(function(){ ids.push($(this).attr('id')); hrefs.push($(this).find('a').attr('href')); })
I know this is old, but as I like the oneliners that jQuery allows you to write, I thought I'd add it:
var allLinks = $('#ulList a').map(function(i,el) { return $(el).attr('href'); }).get();
var allIds = $('#ulList li').map(function(i,el) { return $(el).attr('id'); }).get();