Skip to content

Instantly share code, notes, and snippets.

@sam2332
Last active April 6, 2022 21:25
Show Gist options
  • Save sam2332/e22e2e94b1aa1e7a5cb4d8ba3beb2188 to your computer and use it in GitHub Desktop.
Save sam2332/e22e2e94b1aa1e7a5cb4d8ba3beb2188 to your computer and use it in GitHub Desktop.
Make text areas show one more line than is present in the value
$('textarea.AutoExapander').keyup(function (e) {
e.target.rows = e.target.value.split('\n').length + 1
});
$(document).ready(function () {
$('textarea.AutoExapander').each(function (index, ele) {
ele.rows = ele.value.split('\n').length + 1
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment