Skip to main content

get_attribute

Function get_attribute 

Source
pub fn get_attribute(sel: &Selection<'_>, name: &str) -> Option<String>
Expand description

Get attribute value.

ยงExample

use html_cleaning::dom;

let doc = dom::parse(r#"<a href="https://example.com">Link</a>"#);
assert_eq!(dom::get_attribute(&doc.select("a"), "href"), Some("https://example.com".to_string()));