An open API service indexing awesome lists of open source software.

https://github.com/arxcode40/html5-js

Generate HTML5 element using JavaScript
https://github.com/arxcode40/html5-js

html html5 javascript

Last synced: about 1 year ago
JSON representation

Generate HTML5 element using JavaScript

Awesome Lists containing this project

README

          

# HTML5 JS

## Description
Helper for generate HTML5 element.

## Syntax
```javascript
html5(tag = 'doctype', attributes = {}, ...children): string
```

## Parameters
#### tag

The HTML5 tag.

#### attributes

The HTML5 attributes.

#### children

The HTML5 children.

## Return Values
Return the HTML5 element.

## Examples
**Example #1: Basic example**

```javascript
const html =
html5('div', {'class': 'row'},
html5('div', {'class': ['col-sm-8', 'col-md-6']}, '')
)

console.log(html)
```
```html




```

**Example #2: Doctype declaration**
```javascript
console.log(html5())
```
```html

```

**Example #3: Multiple children**
```javascript
const html =
html5('ul', {},
html5('li', {}, ''),
html5('li', {}, '')
)

console.log(html)
```
```html





```

**Example #4: Self-closing tags**
```javascript
const html =
html5('input', {
'required': true,
'style': {
'display': 'block'
},
'type': 'text'
})

console.log(html)
```
```html

```