Just whipped this up for those wanting the text areas to expand with the typing. A bit of hardcode for the font-size, since I dont know really how to find out a character width. Due to this approximation, with long texts the thing stretches out wayyyy far.
If you improve it at all please post back.
[CODE]
(function(){
$.fn.rubberize = function(options){
defaults = {minRows: 2};
config = $.extend(defaults, options);
return this.each(function() {
obj = $(this);
obj.val(”);
obj.attr(‘rows’, config[‘minRows’]);
obj.keypress(function(e){change_size($(this)); }).blur(function(){change_size($(this));});
});
function change_size(obj){
fsize = parseInt(obj.css(‘font-size’))/2.5;
chars = Math.round(obj.width() / Math.ceil(fsize));
cur_val = obj.val().length + ((obj.val().match(/$/gm).length * chars));
obj.attr(‘rows’, Math.ceil(cur_val/chars));
}
}
})(jQuery)
::USAGE::
$(‘.test’).rubberize();