$bit

JavaScript lib for easy creation DOM elements

Simple

 $bit({
  tag: 'div',
  text: 'Hello World!',
  id: 'Welcome',
  parent: document.body
 });

<body>
  <div id="Welcome">Hello World!</div>
</body>

Architecture

$bit({
 tag: 'div',
 id: 'Names',
 child: [{
   tag: 'div',
   child: { tag: 'span', text: 'Li Light' }
 },{
   tag: 'div',
   child: { tag: 'span', text: 'Tengen' }
 }],
 parent: document.body
});

<body>
  <div id="Names">
    <div><span>Li Light</span></div>
    <div><span>Tengen</span></div>
  </div>
</body>
Properties

Most of the named properties are comparable to HTML

[class, id, title, value…]

But new ones have also been added

[parent]: parent.append($bit);
[parentTop]: parent.prepend($bit);
[child]: $bit.append(child);
[wrap]: $bit = wrap.append($bit);
[append]: $bit.append();
[prepend]: $bit.prepend();
attr: setAttribute;
html: innerHtml;
text: createTextNode;
tag: createElement;


Connect

<head>
  <script src='./bit.js'></script>
</head>

GitHub

View Github