instaedit

1.1.0 • Public • Published

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);
});

Package Sidebar

Install

npm i instaedit

Weekly Downloads

2

Version

1.1.0

License

ISC

Last publish

Collaborators

  • aswathkk