我希望有人能帮助我。
我在我的网站项目中使用domina和clojurescript。 我的问题是我尝试在3个不同的按钮中进行3次点击事件。
我附上下面的代码段,
(defn html1 []
(dom/set-inner-html! (dom/by-id "idofhtml") "<h1> lorem ipsum </h1>"))
(defn html2 []
(dom/set-inner-html! (dom/by-id "idofhtml") "<h1> lorem ipsum2 </h1>"))
(defn html3 []
(dom/set-inner-html! (dom/by-id "idofhtml") "<h1> lorem ipsum3 </h1>"))
(defn ^:export init []
(when (and js/document
(.-getElementById js/document))
(ev/listen! (dom/by-id "link1") :click html1)
(ev/listen! (dom/by-id "link2") :click html2)
(ev/listen! (dom/by-id "link3") :click html3)))
(set! (.-onload js/window) init)
问题仅在于:
(ev/listen! (dom/by-id "link1") :click html1)
工作,另外两个:
(ev/listen! (dom/by-id "link2") :click html2)
(ev/listen! (dom/by-id "link3") :click html3)
不行, 提前感谢您,感谢您的帮助