jQuery Autotab
==============
Autotab is a jQuery plugin that provides auto tabbing and filtering on text fields in a form. Once the maximum number of characters has been reached within a text field, the focus is automatically set to a defined element. Likewise, clearing out the text field's content by pressing backspace eventually places the focus on a previous element.
## Why jQuery Autotab?
* Auto tabbing behaves logically, in both tabbing forward and tabbing backwards.
* Allow your users to easily modify your text in a tab that would otherwise auto tab away.
* Reduce the amount of bad data submitted in a form by filtering text fields.
* Populate multiple text fields by pasting into one.
* Enhance text fields by auto tabbing when a specific character is pressed.
* It is small, fast, easy to load and built on the powerful jQuery library.
## Table of Contents
* [Requirements](#requirements)
* [Installation](#installation)
* [Setup and Usage](#setup-and-usage)
* [Auto Tabbing](#auto-tabbing)
* [Examples](#examples)
* [Remove and Restore](#remove-and-restore)
* [Examples](#examples-1)
* [Filtering](#filtering)
* [Examples](#examples-2)
* [Forced Auto Tabbing](#forced-auto-tabbing)
* [Options](#options)
* [Filter Formats](#filter-formats)
* [Minify](#minify)
* [Feedback](#feedback)
* [Copyright and License](#copyright-and-license)
## Requirements
Autotab works in both jQuery 1.7+ and 2.x. If your site supports Internet Explorer 6, 7, and/or 8, use jQuery 1.7+ since 2.x drops support for these browsers.
## Installation
Add a reference to jquery.autotab.js.
```html
<script src="jquery.autotab.js"></script>
```
## Setup and Usage
Autotab can be setup in several different ways within jQuery's `$(document).ready()` event. The two components that make up Autotab, auto tabbing and filtering, can be managed independently from one another, providing numerous ways of achieving the same result, depending on how indepth you want to setup your form.
### Auto Tabbing
__Note:__ If the selector matches multiple elements, the target and previous fields will be overwritten if previously set.
<table width="100%">
<tr>
<td width="25%">.autotab()</td>
<td>Accepts no arguments and applies auto tabbing rules only.</td>
</tr>
<tr>
<td valign="top">.autotab(string)</td>
<td>
<strong>string</strong>: Can be a filter format or a value that tells the script to remove or restore auto tab and filtering functionality.
<br />
<strong>Note</strong>: Previous auto tabbing order will be overwritten. To change the filter only, call <code>.autotab('filter', '')</code>
</td>
</tr>
<tr>
<td>.autotab(object)</td>
<td><strong>object</strong>: Applies the specified options to all matched elements.</td>
</tr>
</table>
#### Examples
Establishes auto tabbing rules only and forces each field to have a `maxlength` of 1.
```js
$('.answer').autotab({ maxlength: 1 });
```
```html
<div>
<label>Answer 1</label>
<input type="text" id="answer1" class="answer" size="3" /> -
<label>Answer 2</label>
<input type="text" id="answer2" class="answer" size="3" /> -
<label>Answer 3</label>
<input type="text" id="answer3" class="answer" size="3" /> -
</div>
```
Automatically establishes auto tabbing order and number filtering.
```js
$('.number').autotab('number');
```
```html
<div>
<label>Phone Number</label>
<input type="text" id="number1" class="number" maxlength="3" size="3" /> -
<input type="text" id="number2" class="number" maxlength="3" size="3" /> -
<input type="text" id="number3" class="number" maxlength="4" size="5" />
</div>
```
Manually defines auto tabbing order and alphanumeric filtering.
```js
$('#alphanumeric1').autotab({ format: 'alphanumeric', target: '#alphanumeric2' });
$('#alphanumeric2').autotab({ format: 'alphanumeric', target: '#alphanumeric3', previous: '#alphanumeric1' });
$('#alphanumeric3').autotab({ format: 'alphanumeric', target: '#alphanumeric4', previous: '#alphanumeric2' });
$('#alphanumeric4').autotab({ format: 'alphanumeric', target: '#alphanumeric5', previous: '#alphanumeric3' });
$('#alphanumeric5').autotab({ format: 'alphanumeric', previous: '#alphanumeric4' });
```
```html
<div>
<label>Product Key</label>
<input type="text" id="alphanumeric1" class="alphanumeric" maxlength="5" size="4" /> -
<input type="text" id="alphanumeric2" class="alphanumeric" maxlength="5" size="4" /> -
<input type="text" id="alphanumeric3" class="alphanumeric" maxlength="5" size="4" /> -
<input type="text" id="alphanumeric4" class="alphanumeric" maxlength="5" size="4" /> -
<input type="text" id="alphanumeric5" class="alphanumeric" maxlength="5" size="4" />
</div>
```
### Remove and Restore
<table width="100%">
<tr>
<td width="35%" valign="top">
.autotab('remove|destroy|disable')
</td>
<td>
<strong>string</strong>: Disables auto tab and filtering functionality on all matched elements.
<br />
<strong>Note</strong>: Both <code>destroy</code> and <code>remove</code> will disable auto tab and filtering. Standard and custom event bindings persist as they check the status of an element when called. Removing the <code>keydown</code> and <code>keypress</code> can have a negative impact in both user and developer experience if the same events have been bound in other areas.
</td>
</tr>
<tr>
<td valign="top">.autotab('restore|enable')</td>
<td>
<strong>string</strong>: Restores auto tab and filtering functionality on all matched elements.
</td>
</tr>
</table>
#### Examples
Manually turn off auto tab and filtering functionality on all text boxes.
```js
$('#remove-autotab').on('click', function () {
$('input[type=text]').autotab('remove');
});
```
```html
<button id="remove-autotab">Turn Off</button>
```
Manually turn on auto tab and filtering functionality on all text boxes.
```js
$('#restore-autotab').on('click', function () {
$('input[type=text]').autotab('restore');
});
```
```html
<button id="restore-autotab">Turn On</button>
```
### Filtering
__Note:__ If passing an object, the target and previous fields are ignored, if included, to preserve previously established auto tab rules. Use `.autotab(object)` to modify the target and previous fields.
<table width="100%">
<tr>
<td width="25%">.autotab('filter', string)</td>
<td><strong>string</strong>: Applies the specified filter format to all matched elements.</td>
</tr>
<tr>
<td valign="top">.autotab('filter', object)</td>
<td>
<strong>object</strong>: Applies the specified filter options to all matched elements. The target and previous fields are ignored.
</td>
</tr>
</table>
Because of how Autotab's settings are stored, it is possible to define the filter format using `data-autotab-format`. If using `custom`, place your regular expression in `data-autotab-pattern`.
#### Examples
Manually defines text filtering.
```js
$('#salt').autotab('filter', 'text');
```
```html
<div>
<label>Salt</label>
<input type="text" id="salt" maxlength="16" size="12" />
</div>
```
Manually defines alphanumeric filtering and converts all alpha characters to uppercase format.
```js
$('.alphanumeric').autotab('filter', { format: 'alphanumeric', uppercase: true });
```
```html
<div>
<label>Product Key</label>
<input type="text" id="alphanumeric1" class="alphanumeric" maxlength="5" size="4" /> -
<input type="text" id="alphanumeric2" class="alphanumeric" maxlength="5" size="4" /> -
<input type="text" id="alphanumeric3" class="alphanumeric" maxlength="5" size="4" /> -
<input type="text" id="alphanumeric4" class="alphanumeric" maxlength="5" size="4" /> -
<input type="text" id="alphanumeric5" class="alphanumeric" maxlength="5" size="4" />
</div>
```
Manually defines number filtering via `data-autotab-format`. In this example, `$(selector).autotab()` will take the attribut
没有合适的资源?快使用搜索试试~ 我知道了~
jquery autotab插件
共9个文件
js:2个
json:2个
md:2个
5星 · 超过95%的资源 需积分: 10 59 下载量 110 浏览量
2014-04-28
16:42:13
上传
评论
收藏 16KB ZIP 举报
温馨提示
Autotab也是一款功能专一的表单插件,它提供了自动跳格的功能,当用户输入的字符数一旦超过已定义的最大长度,则会根据事先设置的目标自动跳转到 相应元素上,省却了用户按【Tab】键的麻烦。 最典型的应用就是输入IP地址、软件激活码等地方了,我们做的web项目中也有很多地方可以用到这插件,对于提高用户体验还是很有帮助的。
资源推荐
资源详情
资源评论
收起资源包目录
jq22.com-jquery-autotab-master.zip (9个子文件)
jquery插件库.url 119B
autotab.jquery.json 889B
www.jq22.com.txt 111B
js
jquery.autotab.min.js 6KB
jquery.autotab.js 18KB
component.json 581B
demo.html 13KB
CHANGELOG.md 4KB
README.md 14KB
共 9 条
- 1
资源评论
- KevinLee922014-05-06不错,很好用....
- Api4java2014-05-13不错很好,满足现在需求
- lvfan_g2015-10-10比较赞,兼容性也好
hai_cheng001
- 粉丝: 278
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功