Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kanety/jquery-insert-text
https://github.com/kanety/jquery-insert-text
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kanety/jquery-insert-text
- Owner: kanety
- License: mit
- Created: 2019-12-01T09:54:58.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-23T01:29:08.000Z (almost 4 years ago)
- Last Synced: 2024-12-25T04:04:43.174Z (23 days ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# jquery-insert-text
Insert text to input or editable element.
## Dependencies
* jquery
## Installation
Install from npm:
$ npm install @kanety/jquery-insert-text --save
## Usage
Insert text at caret position of `` or `contenteditable` elements:
```html
sample textsample text
``````javascript
$('textarea').insertText('YOUR TEXT');
$('div[contenteditable]').insertText('YOUR TEXT');
```### Options
Insert text at first position:
```javascript
$('textarea').insertText('YOUR TEXT', 'first');
```Insert text at last position:
```javascript
$('textarea').insertText('YOUR TEXT', 'last');
```## License
The library is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).