1.1.0 • Published 7 years ago

instaedit v1.1.0

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

InstaEdit

Javascript plugin to edit any element in-place

  • Convert any text element to editable
  • No dependencies required
  • Easy to use

Usage

Include instaedit.js in your project.

<script src="instaedit.js"></script>

Via data attribute

<div data-instaedit="handleResult" class="instaedit">
    Click to Edit Me
</div>
// Creating new instance of InstaEdit
var instaedit = new InstaEdit();
instaedit.init();

// Function used to handle value after editing
function handleResult(val) {
    console.log(val);
}

Using javascript

<h1 id="story-title">Editable Story Title</h1>
// Getting reference to #story-title
var title = document.getElementById('story-title');

// Creating new instance of InstaEdit
var instaedit = new InstaEdit();

// Adding #story-title to instaedit
instaedit.add(title, function(val) {
    console.log(val);
});