Find value of input element

clojurescript

Solution

In ClojureScript we have two special forms for interop with JavaScript: `.` and `.-`.

`.` should be used to call methods of objects and `.-` should be used to access properties (including functions as a value). If you look at the source code of the `value` function in the Dommy library you'll see that it uses the `.-` special form.

Take a look here: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure#host-interop

This cheatsheet is also useful: https://himera.herokuapp.com/index.html

Problem

I thought this would be pretty straight-forward but it seems like I'm overlooking something. ``` (ns main.core (:require [dommy.core :refer-macros [sel sel1]])) (sel1 :#my-input) => #<[object HTMLInputElement]> (.value (sel1 :#my-input)) => #<TypeError: document.querySelector(...).value is not a function> ```

Original source