public static interface Html4.Element<This> extends HtmlPiece
This interface contains convenience method to set common attributes or non-standard attributes.
Most methods return `this` for method chaining.
Abstract Methods | |
---|---|
CharSequence |
getAttribute(String name)
Get the attribute value.
|
CharSequence |
setAttribute(String name,
CharSequence value)
Set the attribute value.
|
Default Methods | |
CharSequence |
attr(String name)
Get the attribute value.
|
This |
attr(String name,
CharSequence value)
Set the attribute value.
|
This |
attr(String name,
boolean value)
Set a boolean attribute.
|
This |
attr(String name,
int value)
Set an integer attribute.
|
This |
on(String event,
CharSequence script)
Set an event attribute.
|
This |
class_add(CharSequence clazz)
Add a new class to the "class" attribute.
|
This |
class_(CharSequence value)
Set attribute
class="{value}" . |
This |
dir(CharSequence value)
Set attribute
dir="{value}" . |
This |
id(CharSequence value)
Set attribute
id="{value}" . |
This |
lang(CharSequence value)
Set attribute
lang="{value}" . |
This |
style(CharSequence value)
Set attribute
style="{value}" . |
This |
title(CharSequence value)
Set attribute
title="{value}" . |
CharSequence getAttribute(String name)
HtmlElement.getAttribute(name)
.CharSequence setAttribute(String name, CharSequence value)
HtmlElement.setAttribute(name, value)
.default CharSequence attr(String name)
getAttribute(name)
default This attr(String name, CharSequence value)
setAttribute(name)
.default This attr(String name, boolean value)
default This attr(String name, int value)
default This on(String event, CharSequence script)
For example,
_a().on("click", "alert('boo')"); // <a onclick="alert('boo')">
default This class_add(CharSequence clazz)
For example
DIV div = _div(); // <div> div.class_add("c1"); // <div class="c1"> div.class_add("c2"); // <div class="c1 c2">
If `clazz` is null or empty, this method has no effect.
default This class_(CharSequence value)
class="{value}"
.default This dir(CharSequence value)
dir="{value}"
.default This id(CharSequence value)
id="{value}"
.default This lang(CharSequence value)
lang="{value}"
.default This style(CharSequence value)
style="{value}"
.default This title(CharSequence value)
title="{value}"
.