magomimmo / modern-cljs

A series of tutorials on ClojureScript
2.93k stars 288 forks source link

Tutorial 4 - 2nd edition, unexpected output #422

Open bigos opened 7 years ago

bigos commented 7 years ago

section

To resemble the original JS code we also need to access the value property of the email and password elements. CLJS offers the .- special form for these cases as well: (.-property object):

cljs.user> (.-value (.getElementById js/document "email")) "" cljs.user> (.-value (.getElementById js/document "password")) ""

Instead of empty spaces returns "secret@example.com" and "secret"

bigos commented 7 years ago

I did not go to the next step where you have to enter the values. Did the downloaded code change?

elenacanovi commented 7 years ago

Hi bigos,

you get the empty lines

cljs.user=>  (.-value (.getElementById js/document "email"))
""
cljs.user=> (.-value (.getElementById js/document "password"))
""

if the fields email and password in the html page are not filled in. Try reloading the html page and leaving the fields blank before calling the cljs functions in the repl.