Twitter
It's March the 9th and it's snowing... 2 days ago
November, 19 2009

Today links

October, 20 2009

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.

Read the rest of this entry »

August, 03 2009

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.