2

I want to select several items in

ClojureScript

, but can't! How can I get them in CLJS?

Serge Almazov
  • 396
  • 3
  • 11

1 Answers1

9

Have you tried using (.getElementsByClassName js/document "class-name")?

This will return a HTMLCollection JS object, so if you want to convert it to a seq, use something like:

(array-seq (.getElementsByClassName js/document "class-name"))

Also, as a side note, if you want to make HTMLCollection ISeqable, which is a little more idiomatic, check out this other post. Why aren't NodeList / HtmlCollection seqable?

Community
  • 1
  • 1
Antonis Kalou
  • 354
  • 5
  • 7