Element#
- class toui.elements.Element(tag_name='div')[source]#
Bases:
objectCreates an HTML element.
Examples
Creating a
<button>HTML element:>>> button = Element("button") >>> button <button></button>
Setting the inner HTML content of the element:
>>> button.set_content("Click me") >>> button <button>Click me</button>
Setting the element’s attributes:
>>> button.set_attr("name", "button-name") >>> button <button name="button-name">Click me</button>
Methods#
Adds to the inner HTML content of the element. |
|
Adds the specified class to the HTML element if it does not exist. |
|
Removes an HTML element attribute. |
|
Converts a bs4.element.Tag object to an Element object. |
|
Converts HTML code to an Element object. |
|
Gets the value of an HTML element attribute. |
|
Gets all classes of the HTML element as a list. |
|
Gets the inner HTML content of the element. |
|
Gets a child element from its |
|
Get children elements by their tag name and attributes. |
|
Gets uploaded files from element. |
|
Gets the value of the CSS property height inside the |
|
Gets the |
|
Gets the parent element. |
|
Gets the selected option of the HTML element |
|
Gets the CSS selector of an element. |
|
Gets the value of a CSS property inside the |
|
Gets the unique CSS selector of an element. |
|
Gets the |
|
Gets the value of the CSS property width inside the |
|
Checks if the HTML element has the specified attribute. |
|
Creates an HTML event attribute and adds a Python function to it. |
|
Creates the HTML event attribute |
|
Removes all occurences of the specified class from the HTML element. |
|
Sets the value of an HTML element attribute. |
|
Sets the inner HTML content of the element. |
|
Sets the value of the CSS property height inside the |
|
Sets the value of the |
|
Sets the value of a CSS property inside the |
|
Sets the value of the |
|
Sets the value of the CSS property width inside the |
|
Converts the Element object to a bs4.element.Tag object. |
|
Converts the Element object to HTML code. |