1.1.1 • Published 8 years ago

inline-edit-js v1.1.1

Weekly downloads
11
License
ISC
Repository
github
Last release
8 years ago

npm version Bower version

Inline Edit JS

Easily convert HTML elements to editable text fields. It uses latest ECMAScript (ES) syntax and transpiled by Babel to allow use in all modern browsers and on mobile devices.

Usage

To use this package, just import it and pass an element when instantiating.

<div id="my-text"></div>
let el = document.getElementById('my-text');
let editable = new InlineEdit(el);

Then, when clicking anywhere on the element, a text field will show allowing the user to change the text.

Listening for change event

You can also listen in on when the text field contents have changed.

let el = document.getElementById('my-text');
let editable = new InlineEdit(el, {
    onChange: (newValue, oldValue) => {
       // the value has changed
    }
});