My code looks like this:
- Link 1
<
This should work.
var ids = [],
hrefs = []
;
$('#ulList')
.find('a[href]') // only target s which have a href attribute
.each(function() {
hrefs.push(this.href);
})
.end()
.find('li[id]') // only target - s which have an id attribute
.each(function() {
ids.push(this.id);
})
;
// ids = ['id1', 'id2', 'id3']
// hrefs = ['http://link1', 'http://link2', 'http://link3']