NOTICE: I updated all of the JS in this post on 5/24/2005 as there was some cut-n-paste problems before. If you got the code from here before then, please get it again now.
Basically, If I am using a textarea odds are good that my maxlength value is going to be large. Becuase of that I want to give the user some form of clue as to how much of the textarea’s capacity they have used. Since this needs to change dynamically it seems appropriate that I do this as part of the code that also limits the size of the textarea.
As you can see I didn’t do a whole lot of new stuff. However, I did clean up the code some and make it a bit easier to use. It would probably be a good idea to move the code the updates the tooltip text out into its own function that would identify if the tooltip existed and create it if it didn’t, other wise update it. I should probably also update the insertSpan function to take an ID value for the new span so that it would be easier to identify if the tooltip is there.