Simple and tiny Edit in place for component.
- Dependency-free.
- Easy CSS customization.
- Just 1 Kb! (min & gzip)
Check out the demo to see it in action.
$ npm install editable
$ bower install editable
$ component install pazguille/editable
<div id="example">Everything contained within this div is editable.</div>
// Creates a new editable component
var Editable = require('editable');
var element = document.getElementById('example');
var edit = new Editable(element, 'Please, edit it!');
// Binds events
edit.on('done', function (content) {
// Some code here!
// For example, you can send the content to the server via AJAX,
// or save into localStorage.
});
edit.on('cancel', function (content) {
// Some code here!
});
- Chrome (IOS, Android, desktop)
- Firefox (Android, desktop)
- Safari (IOS, Android, desktop)
- Opera (desktop)
- IE 8+ (desktop)
done
: It's emitted when set a new content.cancel
: It's emitted when cancel the edit.
- Guille Paz (Front-end developer | Web standards lover)
- E-mail: [email protected]
- Twitter: @pazguille
- Web: http://pazguille.me
MIT license. Copyright © 2015.