Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jquery.cursor.js:自己编写的光标控制插件 #35

Open
youngwind opened this issue Mar 5, 2016 · 0 comments
Open

jquery.cursor.js:自己编写的光标控制插件 #35

youngwind opened this issue Mar 5, 2016 · 0 comments
Labels

Comments

@youngwind
Copy link
Owner

项目说明

此插件基于jquery,仓库在这儿,主要用途如下

  1. 操作光标在文本中的位置(textarea和input)
  2. 在制定位置插入文字,选中制定的文字片段
    demo

使用方法

1. 安装

bower install jquery --save
bower install jquery-cursor --save

2. 引入

<script src="jquery.js"><script>
<script src="jquery-cursor.js"><script>

3. 使用

3.1 基本用法

$('#textAreaId').cursor({
  "text":"这是插入的一些文字,哪些位置被选中由下面两个参数决定",
  "beginPos":2,  // 开头从0开始计数
  "endPos":5    // 如果省略,则从beginPos一直选中到text的结尾
);

参考资料:
https://gist.github.com/quexer/3619237

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant