Bastiaan van der Plaat

A nice site filled with rubbish

CoffeeScript Input Saver

This is a simple CoffeeScript that selects all the inputs and selects

for element in document.querySelectorAll 'input, select'
    if localStorage[]?
        element.value = localStorage[]
        localStorage[] = element.value
    element.addEventListener 'change', ->
        localStorage[] = this.value

and then listens for changes and saves it to localStorage.