March 1, 2012 jQuery Релизы RU/EN По-русски

jQuery. Wrote a plugin "jquery-cleverfocus"

Today, I released a plugin for jQuery, which, when you enter a some text in "nowhere" intercepts it, and at the expiration of the limit entered symbols - write collected symbols to you specified "input" and puts a "focus".

A plugin is compability with the jQuery 1.7.1, because it has only been tested.

Use cases

Case #1

User comes to the site, seen the search form and typing a search words (herewith he looks at the keyboard). Looking up, he understand that the text wrote "to nowhere", he is irritated. Puts focus to search input, typing several characters, check what he does to type "where necessary" and calmer continues typing in search terms.

Then you say: "Hey! Need to set the focus after loading the DOM!".
But no, this is also a bad decision, I explain it in the Case #2.

Case #2

User comes to the site, he was not interested in the search form, he wants scrolling (Left/Right, Up/Down, PgUp/PgDown, Home/End, etc.) page using the keyboard (users who use laptops without mouse quite a lot), and since we have is the focus on the search form, then we cant scroll the page.

For decision this two cases has been created this plugin: jquery-cleverfocus.


Suppose, you have a form with id="search_input":

<input id="search_input" />

Then, just use the plugin:

    keypress_limit: 3

The plugin includes functional_test.html, which serves to testing form, as well as you can see onlone demo on

Why do I named it that?

First, I named it as "jquery-autofocus", but then searched in Google and found this name plugin with the same name, which is designed to emulate the autofocus attribute of HTML5 in HTML earlier versions.

Later, I named it "jquery-smartfocus", but here waiting for me disappointed, because there is such a plugin.

In the end, I named it by "humanly" - cleverfocus.


Post your comment