HTML DOM anchor Object for Rust WebAssembly

Create a anchor Object

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


    let anchor = document.create_element("anchor")
    .unwrap()
    .dyn_into::<web_sys::HtmlAnchorElement>()
    .unwrap();

Access a anchor Object

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


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

Properties

Functions

features/dependencies
  • web-sys HtmlAnchorElement


        features = [
        'HtmlAnchorElement',
        ]

Source Code