I’m trying to get all the found elements within a <div>, but by default it stops when it found the first occurrence, but I want it to list every found element’s id value.
So this doesn’t work:
listy = $("DIV").find("SPAN").attr("id");
I’ve been experimenting with .get and .map, but I think they’re not what I want..
Without
findis even better:Live DEMO
If you want only
<span>withidattribute defined, change the selector to:If you want all the
ids as a string:The parameter of
joinis the delimiter, e.g..join('-')or.join(',')or without:.join('')