Hi,
I am fairly new to Clojurescript (been learning for around 2 months) and I have
a problem with a small project I am working on. My aim is for a greeting to be
inputted and then a response to be outputted depending on the greeting, all on
the browser.
My code:
(ns myproject.greeting
(:require [reagent.core :as r]
[ajax.core :as ajax]))
(defn input [greeting]
[:input {:type "text"
:value @greeting
:on-change (if (= greeting "Hello")
(str "Hello, how are you?"))}])
(defn hello-browser []
(let [val (r/atom "")]
(fn []
[:div
[:p "Enter greeting here: " [input val]]
[:p "My response is: " @val]
])))
The core.cljs file contains:
(ns myproject.core
(:require ...
[myproject.greeting :as g])
(:import goog.History))
(defn home-page []
[:div.container
[g/hello-browser]]
)
What I want my function to do is when you type "Hello" into the input, the
response is "Hello, how are you?". Any help is much appreciated. Thanks.
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.