Skip to content

Commit c551aac

Browse files
committed
section 7 video 2
1 parent 867355e commit c551aac

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cljs/project1/hello.cljs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
(ns project1.hello)
22

3-
(js/alert "Hello ClojureScript!")
4-
3+
(let [el (.createElement js/document "a")
4+
txt (.createTextNode js/document "Hello world!")]
5+
(.appendChild el txt)
6+
(.setAttribute el "href" "#clojure")
7+
(.addEventListener el "click"
8+
(fn [] (js/alert (str "Clicked: " (.-outerHTML el)))))
9+
(.appendChild (.getElementById js/document "holder") el))

resources/public/js.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<head>
33
</head>
44
<body>
5+
<div id="holder">
6+
Content here...
7+
</div>
58
<script src="/app.js"></script>
69
</body>
710
</html>

0 commit comments

Comments
 (0)