Skip to content

Commit 6c97f66

Browse files
committed
Update README with an example
1 parent 131d84b commit 6c97f66

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,28 @@
11
# html-chain
22
A super small (only 2.7kB) javascript library to make html by chaining javascript functions.
3+
4+
## Example
5+
6+
```js
7+
var test = dom()
8+
.add('div', {className: 'container'})
9+
.contains('div', {className: 'header'})
10+
.contains('h5', {className: 'headerTitle', text: 'This is a header'}).end()
11+
.and('div', {className: 'content'})
12+
.contains('p', {text: 'This is the content'}).end()
13+
.end()
14+
.build();
15+
```
16+
17+
Produces -
18+
19+
```html
20+
<div class='container'>
21+
<div class='header'>
22+
<h5 class='headerTitle'>This is a header</h5>
23+
</div>
24+
<div class='content'>
25+
<p>This is the content</p>
26+
</div>
27+
</div>
28+
```

0 commit comments

Comments
 (0)