In jQuery, it's easy to select elements as an array.
$ ("a"); // return as elements of an array of anchors
But is it possible to select the attributes of the mapped elements as an array?
Currently I need to do something like ...
links = [];
$ ("a"). each (function () {
href = $(this).attr("href"); links.push(href);
});
Is there a better way to populate a link variable with href of all matched anchors?
javascript jquery
Howard
source share