HTML DOM div Object for Rust WebAssembly

Create a div Object

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


    let div = document.create_element("div")
    .unwrap()
    .dyn_into::<web_sys::HtmlDivElement>()
    .unwrap();

Access a div Object

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


    let div = document.get_element_by_id("my-div")
    .unwrap()
    .dyn_into::<web_sys::HtmlDivElement>()
    .unwrap();

Properties

Functions

features/dependencies
  • web-sys HtmlDivElement


        features = [
        'HtmlDivElement',
        ]

Source Code