March 2019
Intermediate to advanced
208 pages
5h 11m
English
getElementById gives us a value of type option(Webapi.Dom.Element.t), where the t stands for “type.” This is a generic element. It is the “parent” of more specific types of elements such as HTML elements or SVG elements, and its interface doesn’t include any functions for obtaining an element’s value attribute. The interface for HTML elements does have such a function. Since we are dealing with an HTML element, we’ll use unsafeAsHtmlElement to tell ReasonML to treat this element as an HTML element.
Why is it Called Unsafe? | |
|---|---|
|
|
The function name unsafeAsHtmlElement contains unsafe because it calls JavaScript directly and will work ... |
Read now
Unlock full access