Get, Set and Remove attributes
$value = $e->href;
$e->href = 'my link';
$e->href = null;
if(isset($e->href))
echo 'href exist!';
Magic attributes
$html = str_get_html("<div>foo <b>bar</b></div>");
$e = $html->find("div", 0);
echo $e->tag;
echo $e->outertext;
echo $e->innertext;
echo $e->plaintext;
Attribute name |
Description |
$e->tag |
Read or write the tag name of element. |
$e->outertext |
Read or write the outer HTML text of element. |
$e->innertext |
Read or write the inner HTML text of element. |
$e->plaintext |
Read or write the plain text of element. |
Tips
echo $html->plaintext;
$e->outertext = '<div class="wrap">' . $e->outertext . '<div>';
$e->outertext = '';
$e->outertext = $e->outertext . '<div>foo<div>';
$e->outertext = '<div>foo<div>' . $e->outertext;