Adjust Td Height Depending On Textarea Rows
I have a textarea with rows='1' inside a , so it takes up as little space as possible when empty. Now I was wondering, how would I best 'expand' the textarea when the use
Solution 1:
Try this:
$('.expand').on('keypress', function (e) {
var code = (e.keyCode ? e.keyCode : e.which);
if (code == 13) {
// Enter pressed... do anything here...
var rows = $(this).attr('rows');
var rowsNew = parseInt(rows) + 1;
$(this).attr('rows', rowsNew);
}
});
Post a Comment for "Adjust Td Height Depending On Textarea Rows"