Skip to content

Library for build webpages with javascript in fewer lines

Notifications You must be signed in to change notification settings

lucas1richard/Constructors.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Constructors

Build webpages without a templating engine in fewer lines of code. This is useful for Chrome extensions that need to add content to pages.

Example

1. var h1 = new DivElem({ appendTo: document.body, type: 'h1', txt: 'Hello', clss: 'text-center', clck: function() { console.log('Hello'); } });

The code above creates a h1 element, appends it to the document body, gives it the text 'Hello', and adds an event listener for click. Compare it to the same accomplishment below:

1. var h1 = document.createElement('h1');
2. h1.innerText = 'Hello';
3. h1.className = 'text-center';
4. h1.addEventListener('click', function() {
5.     console.log('Hello');
6. });
7. document.body.appendChild(h1);```

About

Library for build webpages with javascript in fewer lines

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages