Hacker News new | ask | show | jobs
by ithayer 5435 days ago
Any good examples of some JS that's cool to run?
1 comments

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"))