Apologies for the less-than-fully-assed entry that follows:
I thought a pretty common task for jQuery would be to make a textarea automatically expand as content was added into it. And a bit of googling shows that a number of people have taken a stab at it. But it looks like no one has gotten it quite right, and I don't have enough time and energy to fix that.
The best I found is padolsey's jQuery.fn.autoResize. Once you include the .js file usage is trivial:
<script>
$(document).ready(function() {
$('textarea').autoResize();
});
</script>
There are some configuration options as well.
I'm not 100% enamored of it: if you edit the value manually (like by calling $("textarea").val()) , the thing is not resized, and while it has basic coverage for resizing when users paste in text, it gets a bit wonky.
No comments:
Post a Comment