Skeleton Form

For js-skeleton

Skeleton.js form

Skeleton Form

Skeleton gives you a very clean way to organize your forms. remember the form part of the html?

<form name="todo-form">
  <input type="text" placeholder="What needs to be done?" id="todo-input" />

Let’s use skeleton to give readable structure to the javascript:

    name: 'todo-form',
    inputs: {
        text: 'todo-input'
    submit: {
        input: 'text',
        keyCode: 13 // Enter Key Code
    onSubmit(e) {
        let text = this.text.value;
        if(!text) {
        TodosList.push({ text }); // push and render todo
        Skeleton.form.clear(; // clear form input

Now, the html peace and the javascript are organized in a very easy-to-understand way. You only need to provide the ‘name’ of the form and its ‘inputs’, the ‘submit’ button id or the input submitted with its key code, and an ‘onSubmit’ function.

‘Skeleton.form.clear’ lets you clean all the inputs text when you provide form name.

Guy Peer

By Guy Peer

I am a web developer. Creator of skeleton.js.

Looking for more js-skeleton tutorials?

View all tutorials for js-skeleton