File Size: 14KB
Total Views: 3
Date Created:
Last Modified Date:
Official Website: Go to website
License: MIT
JqInlineEdit is a very simple and lightweight inline editing html plugin that allows you to edit any inline text using an input field, select box or textarea. When triggered on a specific element it will converts to input, select or textarea where you can edit the text and after editing the text it will revert to its previous state.
Features:
- Very useful and easy to use.
- Supports on all modern devices and browsers.
- It has several callback functions.
- Supports input, textarea and a select box.
How to use it:
1. Include the jQuery inline-edit.jquery.js
at the bottom of the web page.
<script src="path/to/inline-edit.jquery.js"></script>
2. Add the basic HTML to the page.
<span class="input"><button class="btn btn-success">Click me to edit</button></span>
3. Initialize the plugin and we’re ready to go.
$(".input").inlineEdit({
type: 'text',
onChange: function (e, text, html) {
// Executes when exiting inline edit mode and a change has been made
},
onEdit: function (e) {
// Executes when entering inline edit mode
},
onNoChange: function (e) {
// Executes when exiting inline edit mode but no change has been made
}
});
Plugin’s default options:
Property | Type | Options | Default | Description |
---|---|---|---|---|
type | string | text, select, textarea | text | The type of value the clicked text will turn into. |
className | string | null | A custom class to add to the created inline edit element. | |
on | string | Any jQuery trigger
[click, dblclick, etc.] |
click | This is how the inline edit will be triggered |
customData | object | null | Custom properties to add to the inline edit tag | |
data | object | null | Options for the select as a key:value object | |
trim | bool | true/false | true | Trim whitespace around text before loading into the text input or textarea |
Methods
Method | Values | Description |
---|---|---|
onChange(this, text, html) |
|
Executes when exiting inline edit mode and a change has been made |
onEdit(this) |
|
Executes when entering inline edit mode |
onNoChange(this) |
|
Executes when exiting inline edit mode but no change has been made |
Events
Event | Description |
---|---|
inlineEdit.on.edit | Fires when exiting inline edit mode and a change has been made |
inlineEdit.on.change | Fires when entering inline edit mode |
inlineEdit.on.noChange | Fires when exiting inline edit mode but no change has been made |