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

unsafeAsHtmlInputElement #210

@mununki

Description

@mununki

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("")
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions