View on GitHub

jQuery.selection

選択範囲のテキスト操作 / キャレット操作 jQuery プラグイン

Download this project as a .zip file Download this project as a tar.gz file

English version

これは何?

選択範囲のテキストを操作するための jQuery プラグインです。

テキスト選択(キャレット)位置や、選択テキストを取得したり、選択されているテキストの置き換えや挿入などを行えます。

使い方

jQuery 本体と、このプラグインを読み込んで使用します。

具体的には下記のように使用します。

API

API Documentation

デモ

入力フォームの選択テキスト操作

デモ1

テキストボックス(1行テキスト)内で選択されているテキストを取得するデモです。


デモ2

テキストエリアの選択テキストに対して挿入/置き換えを行うデモです。

$.selection() のデモ

ウィンドウ内の選択部分のテキスト/HTMLを取得するデモです。

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.
Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.

It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar.
The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen.
She packed her seven versalia, put her initial into the belt and made herself on the way.

When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet Village and the subline of her own road, the Line Lane.
Pityful a rethoric question ran over her cheek, then

Result value / 取得結果

ライセンス/連絡先

The MIT License

Copyright © 2010-2012 Koji Iwasaki (@madapaja).

バグ報告は Issues に投げていただくか、Pull request をください。