Code Monkey home page Code Monkey logo

character-counter.js's Introduction

character-counter.js

Script that counts characters of any field you can write on in HTML.

Character counter for text fields in HTML

Character-counter.js is a script that counts the characters in a text-input field. By default, character-counter.js looks for a text field with "id = messagebody" and appends the counter behind it. Also, by default, uses CSS variable 'color' from body for the color of the counter.
  • Character-counter.js supports copy and paste of text

HOW TO USE

Character-counter.js is designed for a specific case, but you can change it to your needs easely. In the code case, it counts the characters from a textbox with "id=messagebody" and a not null maxlength. It uses the maxlength to create the counter, then removes it (line 9). It also uses default body color to paint the counter.

To change ID (or way to search for input field), go to line 6. To change CSS, go to lines 19-23.

This code supports paste of text.

character-counter.js's People

Contributors

sercantus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.