1.5.1 • Published 1 month ago

html-tag-js v1.5.1

Weekly downloads
5
License
MIT
Repository
github
Last release
1 month ago

html-tag-js

A simple library for creating and manipulating DOM using JavaScript DOM api. See

Documentation

Installation

npm i html-tag-js

or directly import into browser

path/to/html-tag-js/dist/tag.js

Usage

es6

import tag from 'html-tag-js';
import 'html-tag-js/dist/polyfill'; //Important (only once);
usage
//creating element with options
const span = tag('span', {
  textContent: 'This is span tag',
  className: 'myspan',
  id: 'span1',
});

//create element with child
const div = tag('div', {
  child: span,
});

const elements = [el1, el2, el3];

//append child(s)
div.append(...elements);

//easily get any child of parent element using get method which
//takes query selector string as argument
div.get('#span1');

//get all element
//return array of html elements
div.getAll('span');

// --or--

tag.get('body');
tag.getAll('.mydiv');

//parse html string

//returns html element
const el = tag.parse('<div class="mydiv"></div>');
console.log(el);

//return html element collection
const el2 = tag.parse('<div class="mydiv"></div><p class="myp">');
1.4.4

1 month ago

1.5.1

1 month ago

1.5.0

1 month ago

1.4.3

3 months ago

1.4.2

3 months ago

1.4.1

3 months ago

1.4.0

3 months ago

1.3.0

4 months ago

1.2.0

5 months ago

1.1.38

12 months ago

1.1.39

11 months ago

1.1.41

10 months ago

1.1.40

11 months ago

1.1.37

1 year ago

1.1.36

1 year ago

1.1.29

1 year ago

1.1.28

1 year ago

1.1.30

1 year ago

1.1.34

1 year ago

1.1.33

1 year ago

1.1.32

1 year ago

1.1.31

1 year ago

1.1.35

1 year ago

1.1.19

2 years ago

1.1.23

1 year ago

1.1.22

1 year ago

1.1.21

2 years ago

1.1.20

2 years ago

1.1.27

1 year ago

1.1.26

1 year ago

1.1.25

1 year ago

1.1.24

1 year ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.16

2 years ago

1.1.15

2 years ago

1.1.14

2 years ago

1.1.13

2 years ago

1.1.18

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.2.22

4 years ago

0.2.21

4 years ago

0.2.20

4 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.1

5 years ago