Re:ClojureScript gets a REPL that drives the browser
by ithayer on Thursday July 28, 2011 @03:54PM
(#2818619)
Any good examples of some JS that's cool to run?
[ Parent
| on HN ]
Re:ClojureScript gets a REPL that drives the browser
by ibdknox on Thursday July 28, 2011 @04:06PM
(#2818673)
Not "cool" per se, but here's something that works :)
(require '[goog.dom :as dom])
(def body (aget (dom/getElementsByTagNameAndClass "body") 0))
(defn elem-factory [tag text]
(let [elem (dom/createElement tag)]
(dom/setTextContent elem text)
elem))
(dom/appendChild body (elem-factory "p" "my new tag"))