getElementsByClassName in ClojureScript?

I want to select several items in

ClojureScript

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

Answers


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?


Need Your Help

How to perform and display the progress of a sequence of operations in PHP?

php jquery ajax

I need to invoke a sequence of operations and show live progress of the invocations and results of already executed operation on single page in PHP. The operation could be a commandline invocation ...

Does session.gc_maxlifetime specify the maximum lifetime since the last change of a single session variable?

php session

I'm using a java based uploading construct http://www.javaatwork.com/java-upload-applet/details.html that I tried running over night.