-
Notifications
You must be signed in to change notification settings - Fork 56
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 />
Input:
html( 'ul',
html( 'li', 'a' ),
html( 'li', 'b' )
);
Output: <ul><li>a</li><li>b</li></ul>