Twitter Like Count Remaining Character Using Jquery

1

Twitter has a nice feature in which it will show how many characters remaining of your tweet. It also limits the characters to only 160. In this post i will show you how to do twitter like count remaining character using Jquery.

Live Demo

It is very interesting and easy to code. Use it to enrich your web application.

The Html
This is our html file. Simple enough, just using textarea, button and a span to dynamically change the number of remaining characters.

The Java Script
On the first load page of our count remaining character using jquery, we set the button to be disabled and also when the characters is greater than 160 or equal or less than 0. There are two other methods that are invoked when characters are greater than 160 or equal or less than 0, it is a method to make the text inside textarea become line through and a method to make the number of remaining characters become red.

The CSS
This Css make our web application looks beautiful, not only a white page. .minus class is added and removed dynamically when application is running. It depends on remaining characters, whether remaining characters are greater than 160 or equal to or less than zero like i said above.

Here’s some screenshot of our web app
Count Remaining Character Using Jquery

You can try the Demo

Live Demo
Facebook Comments
 

Agung Setiawan

Agung Setiawan adalah software engineer di BukaLapak.com, penulis sekaligus pecinta sastra, dan pembaca buku

 
Halo, perkenalkan saya Agung Setiawan.
Saya Software Engineer di BukaLapak.
Simak pemikian saya soal dunia Software Engineering via Twitter di @agungsetiawanmu dan facebook
Blog ini saya update seminggu sekali jadi sering-sering saja mampir
Mau belajar Vim bareng saya?
Belajar ngoding dari nol menggunakan PHP

Leave a Reply

Your email address will not be published. Required fields are marked *