Insert Text At Specific Position In A Text Field - insert-text

File Size: 9.4 KB
Views Total: 3687
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Insert Text At Specific Position In A Text Field - insert-text

insert-text is a small jQuery plugin that allows the user to insert any text at a specific position (e.g. caret) or before/after the current content in a text field.

See Also:

How to use it:

1. Load the minified version of the jQuery insert-text plugin from the dist folder.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/dist/jquery-insert-text.js"></script>

2. Insert text at cursor position in your text field.

<textarea id="example">
  Sample Text
</textarea>
$('#example').insertText('Text To Insert');

3. Insert text at the end of the current content in your text field.

<textarea id="example">
  Sample Text
</textarea>
$('#example').insertText('Text To Insert', 'last');

4. Insert text at the beginning.

<textarea id="example">
  Sample Text
</textarea>
$('#example').insertText('Text To Insert', 'first');

5. Insert text at a specific position in your text field.

<textarea id="example">
  Sample Text
</textarea>
$('#example').insertText('Text To Insert', 10);

This awesome jQuery plugin is developed by kanety. For more Advanced Usages, please check the demo page or visit the official website.