-
Notifications
You must be signed in to change notification settings - Fork 55
html()
scribu edited this page Feb 24, 2012
·
6 revisions
html()
is a function you can use for generating HTML.
Note that the attributes are passed through esc_attr()
, but the content is not escaped in any way.
- Input:
html( 'p', 'Hello world!' );
- Output:
<p>Hello world!</p>
- Input:
html( 'a', array( 'href' => 'http://example.com' ), 'A link' );
- Output:
<a href="http://example.com">A link</a>
-
Input:
html( 'input', array( 'type' => 'checkbox', 'name' => 'foo', 'checked' => true ) );
-
Output:
<input type="checkbox" name="foo" checked="checked" />
-
Input:
html( 'input', array( 'type' => 'checkbox', 'name' => 'foo', 'checked' => false ) );
-
Output:
<input type="checkbox" name="foo" />
Input:
html( 'ul',
html( 'li', 'foo' ),
html( 'li', 'bar' )
);
Output: <ul><li>foo</li><li>bar</li></ul>