Hi,
I am trying to retrieve the input value from the code below via ```
let i_elt = Html.(input ~a:[ a_id "input1" ] ()) in
let i_dom = To_dom.of_input i_elt in
i_dom##.oninput
:= Dom_html.handler (fun evt ->
(* doesn't work*)
(* Js.Opt.iter evt##.target (fun t -> log t##.value); *)
Js.Opt.iter evt##.target (fun tgt -> log t##.id);
Js._true);
It seems tgt
object is an instance of an Dom_html.element
rather than the Dom_html.inputElement
, is there a way to retrieve the text value entered in input
element. I have tried innerHTML
and textContent
, but no luck. Both return empty string.