2

I'm searching a possibility to get an array of elements in E4X for an unknown tagname (like the DOMs getElementsByTagName) inside of a function.

My first thought was something like:

(function (doc, tag) {
    return doc..[tag];
})

Is there any chance to do this?

fb55
  • 1,197
  • 1
  • 11
  • 16

1 Answers1

2
doc.descendants(tag);

And there's always eval :)

var query = "doc.." + tag;
eval(query);
Anurag
  • 140,337
  • 36
  • 221
  • 257