Element Class

Create object

Create a object of the Html\Element class:

$element = new Html\Element();

Init

Init the class:

$element->init(string $tag, array $attributeArray);

Copy

Copy the element:

$element->copy();

Attribute

Set attribute to the element:

$element->attr(mixed $attribute, string $value);

Remove attribute from the element:

$element->removeAttr(string $attribute);

Class

Add class to the element:

$element->addClass(string $className);

Remove class from the element:

$element->removeClass(string $className);

Val

Set value to the element:

$element->val(string $value);

Text

Set text to the element:

$element->text(string $text);

Html

Set HTML to the element:

$element->html(string $html);

Append

Append HTML to the element:

$element->append(string $html);

Prepend

Prepend HTML to the element:

$element->prepend(string $html);

Clear

Clear HTML of the element:

$element->clear();

Render

Render the element:

$element->render();

Stringify the element:

echo $element;
Edit on GitHub