web_sys::Document::create_element function

Example

Create an Element node by tagName (e.g. "p", "div").


	pub fn document_create_element()
	{
		let window = web_sys::window().expect("global window does not exists");    
		let document = window.document().expect("expecting a document on window");
		let body = document.body().expect("document expect to have have a body");
		let val = document.create_element("p").unwrap();
		val.set_inner_html("Hello World from WebAssemblyMan!");
		body.append_child(&val).unwrap();
	}	

Function


	pub fn create_element(&self, local_name: &str) -> Result<Element, JsValue>

features/dependencies

Source Code