HTML DOM image Object for Rust WebAssembly

Create a image Object

You can create an <image> object using the document.create_element method.


    let image = document.create_element("image")
    .unwrap()
    .dyn_into::<web_sys::HtmlImageElement>()
    .unwrap();

Access a image Object

You can access an <image> object using the document.get_element_by_id method.


    let button = document.get_element_by_id("my-image")
    .unwrap()
    .dyn_into::<web_sys::HtmlImageElement>()
    .unwrap();

Properties

Functions

features/dependencies
  • web-sys HtmlImageElement


        features = [
        'HtmlImageElement',
        ]

Source Code