HTML DOM span Object for Rust WebAssembly

Create a span Object

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


    let span = document.create_element("span")
    .unwrap()
    .dyn_into::<web_sys::HtmlSpanElement>()
    .unwrap();

Access a span Object

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


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

Properties

Functions

features/dependencies
  • web-sys HtmlSpanElement


        features = [
        'HtmlSpanElement',
        ]

Source Code