Floki.attribute

You're seeing just the function attribute, go back to Floki module for more information.
Link to this function

attribute(html, attribute_name)

View Source

Specs

attribute(binary() | html_tree() | html_node(), binary()) :: list()

Returns a list with attribute values from elements.

Examples

iex> Floki.attribute([{"a", [{"href", "https://google.com"}], ["Google"]}], "href")
["https://google.com"]
Link to this function

attribute(html, selector, attribute_name)

View Source

Specs

attribute(binary() | html_tree() | html_node(), binary(), binary()) :: list()

Returns a list with attribute values for a given selector.

Examples

iex> Floki.attribute([{"a", [{"href", "https://google.com"}], ["Google"]}], "a", "href")
["https://google.com"]

iex> Floki.attribute([{"a", [{"class", "foo"}, {"href", "https://google.com"}], ["Google"]}], "a", "class")
["foo"]