- Good karma: an in-depth review of Ubuntu 9.10 Ars review
- Simply Buttons v2 Javascript/CSS stylish buttons
- How to wire your house for Ethernet networking from Instructables
- 10 Easy jQuery Tricks for Designers
Today links
Textarea char counter, a jQuery plugin
Some weeks ago I received a customer request to add a character counter to a textarea field and I made it using “classic” Javascript. Now that I’m learning jQuery and have some spare time, I tryed to transform my custom function to a jQuery plugin.
This is my first attempt to build a jQuery plugin and maybe there’s already another plugin that does the same thing but it have been a really nice exercise.
Check out the plugin code and some more details after the break.
Javascript getElementById() shortcut
Do you love the wonderful javascript dollar shortcut $('myId') but cannot use jQuery or Prototype? Don’t worry, you can define your custom shortcut for the too long document.getElementById() function:
function $(id) { return document.getElementById(id); }
Now you can sobstitute this:
var divContent = document.getElementById('myId').innerHTML;
with this:
var divContent = $('myId').innerHTML;
Obviously you don’t get all the bells and whistles that you would get using jQuery, but it’s a start.
