Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

unsafeAsHtmlInputElement #210

Open
mununki opened this issue Jul 14, 2021 · 0 comments
Open

unsafeAsHtmlInputElement #210

mununki opened this issue Jul 14, 2021 · 0 comments

Comments

@mununki
Copy link

mununki commented Jul 14, 2021

I have an issue to get a html input element. I can't find any method to convert Dom.element to Dom.htmlInputElement or Dom.htmlElement to Dom.htmlInputElement. I could make an identity binding to convert it as a workaround. Is there any other way to get an html input element from dom or convert it?

external unsafeAsHtmlInputElement: Dom.element => Dom.htmlInputElement = "%identity"

let inputFile = Dom.document |> Dom.Document.getElementById("input-file")
inputFile
->Belt.Option.map(inputFile' => {
  inputFile'->unsafeAsHtmlInputElement->Dom.HtmlInputElement.setValue("")
})
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant