Intelligent prompt input box cursor position based on jQuery & CSS3

Source: Internet
Author: User

For a given input box, it would be great to show the position of the current cursor in the entire input string and the number of remaining texts when the text exceeds the input box! It would be nice if you could implement this function without modifying DOM on any website.

Articles you may be interested in
  • Recommended 12 excellent browser compatibility testing tools
  • 10 sets of exquisite free website background management system templates
  • 8 best cloud integrated development environments for developers
  • Ten carefully selected online CSS3 code generation tools
  • 8 recommended free Web security testing tools

 

In this article, we useJQueryThe position of the cursor in the smart input box. It does not need images and uses pureCSS3It is implemented in real time and accurate, which means that it automatically adapts when you add or delete text. Use the event proxy mechanism, so you don't have to worry about performance issues.

 

 

Download Source Code Online Demo

 

  This plug-in has the following features:

  • No image, pure CSS rendering;
  • No additional DOM support is required;
  • Supports automatic text movement;
  • Accurate and dynamic, which means that you can automatically add or delete texts;
  • It is displayed only when the text exceeds the visible area of the input box;
  • Use the event proxy mechanism, so you don't have to worry about performance issues;

 

  The usage is very simple. The following is the sample code:

// Initialize $ ('input: text '). inputIndicator (); // set the background position during initialization $ ('input: text '). inputIndicator ({bgPos: '31px '}); // cancel the prompt $ ('input: text '). inputIndicator ('deststroy ');

 

  JSFiddle Online Demo(If the following demo does not display, refresh the page or visit address: http://jsfiddle.net/indicator ):

Browser compatibility:Best in Chrome, Firefox, and Safari!

Articles you may be interested in

 

  • 10 sets of exquisite free website background management system templates
  • Well-selected excellent jQuery Ajax paging plug-ins
  • Ten carefully selected online CSS3 code generation tools
  • 13 sets of exquisite webpage icons
  • Cutting-edge Web: Amazing CSS3 applications

 

Link to this article: Innovative application: A jQuery plug-in that intelligently prompts the input location

Source: Dream sky ◆ focus on front-end development technology ◆ share web design resources

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.