Fork me on GitHub
M J10:02:44

How can I get the element by id of a div element, for example, I have:

<div aria-hidden="false">
<div id="id-10822"></div>
I would like to getElementById of the "id-10822", then gets its parents "aria-hidden" value


You may use whichever of the browser's built-in functions you would use in Javascript. Remember the getElementById is a function on the DOM Document, which in ClojureScript can be referenced as js/document. So you can start with (.getElementById js/document "id-10822")

👍 2

...and as a lucky CLJS user, you can also use :

(goog.dom/getElement "id-10822")


Oops. Missed the rest of the Q. Once you have the div, this gives you the parent:

(.-parentNode div) or (goog.dom/getParentElement div)
Once you have the parent, this gives you "aria-hidden":
(.-ariaHidden parent) or (goog.object/get parent "ariaHidden")


I have a CLJ (lein) and CLJS (shadow) project. I kept them separate repositories until now, then yesterday merged them into one repo. One issue I have been having is with CIDER, where I cannot connect to both at the same time. I assume this is because I am using different build tools; are there any good resources on converting a lein project into shadow project? I assume project.clj has to be converted to shadow-cljs.edn, but not sure how.


I feel your pain, been through this myself. I wish had the deets fresh, but what worked for me was following the shadow-cljs instructions for building a project from scratch, but adding the same elements to my lein project. I will see if I can recover what I did...and it might have been the other way around!


Oh, and don't be shy about taking this to the #C6N245JGG channel.


btw, if you do not mind a one-way conversion, I have been known to start from a starter project under a new build tool and just copy my source in.


OK, not finding the lein->shadow steps I was thinking of. Must have gone shadow->figwheel. Have you looked at

❤️ 2

I will take a look at that link


Also might ask that channel later


To me the shadow doc is great but not quite direct enough for me to follow, but someone in #C6N245JGG may be able to point you to some step-by-step doc. And don't forget my brute force 🙂 solution: find a shadow starter project and copy your source into that.