Looking to create a character counter similar to Twitter in a contenteditable
div
. The goal is to restrict users to typing a maximum of 140 characters.
Using jQuery for character count and remaining display, but encountering an issue where the Enter key (new line) is not being counted as a character. Need to account for new lines in the character count.
Attempted using a textarea
, but running into problems with specifying max-height
to only show the scrollbar when exceeding this height. No limitations on lines or characters in the textarea.
DEMO: https://jsfiddle.net/oLomzakh/
In need of assistance to incorporate new line count in the character count. Can you help?