[go: up one dir, main page]

pakertaja
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Pakertaja JavaScript library travis coveralls npm

Pakertaja is an JavaScript library which main purpose is to provide an easy way to generate HTML from JavaScript.

Usage example

function renderProduct(product) {
  return p.div(
    { class: 'product' },

    p.h1(product.title),

    p.p(product.description),

    p.form(
      p.label({ for: 'quantity' }, 'Quantity: '),
      p.input({ type: 'number', id: 'quantity', min: 10 }),
      p.button(
        'Add to cart',
        {
          type: 'submit',
          onclick: ev => {
            ev.preventDefault();
            alert(`Added ${document.getElementById('quantity').value} products into cart.`);
          },
        }
      )
    )
  );
}

document.body.appendChild(renderProduct({
  title: 'Battlefield Earth DVDs',
  description: 'Critically acclaimed as one of the best movies ever made.',
}));

Readme

Keywords

Package Sidebar

Install

npm i pakertaja@0.1.0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • rauli