Textarea Character Counter In Forms

i have javascript code for textarea.

how to use this code in Textarea field item in a form using cactiveform .??

plz reply

<script type="text/javascript" src="http://www.google.com/jsapi"></script>  

<script type="text/javascript" language="javascript">  

google.load("jquery", "1.4.2");  

var characterLimit = 150;  





	$('#myTextarea').bind('keyup', function(){  

    	var charactersUsed = $(this).val().length;  


    	if(charactersUsed > characterLimit){  

        	charactersUsed = characterLimit;  

        	$(this).val($(this).val().substr(0, characterLimit));  




    	var charactersRemaining = characterLimit - charactersUsed;  






You could create YII widget for this purpose - http://www.yiiframework.com/doc/guide/1.1/en/basics.view#widget . Try to understand what is there and ask questions that you will have after that.