My query is quite similar to the topic discussed in this thread on automatic newline in textarea. However, my situation involves multiple textareas with a 1-row attribute, making it seem like writing on air due to the absence of visible borders (I've set the CSS border property as border: 0;).
I am looking to use jQuery or JavaScript to determine when a user's text input reaches the end of a row in a textarea and automatically move to the next one below. One approach could be counting characters, but different characters have varying widths.
One idea I'm considering is placing a hidden element at the edge of the textareas to trigger the nexttextarea.focus() event, yet I’m unsure how to implement this.
I’ve experimented with various hacks but only one appears promising - storing each character in an array with its corresponding default width value in pixels e.g., 'a'=>0.7px,'b'=>0.9px . This method seems memory-intensive since I'd need to store values for uppercase letters, lowercase letters, and numerous other characters. Subsequently, calculations based on browser width might reveal when the textarea row aligns with the browser’s edge, assuming the current textarea has a width of 100% without a parent container.
If anyone can suggest a straightforward or advanced approach to tackle this issue, please assist me. A major concern is that IE and Mozilla display scroll bars upon resizing the browser window, which contradicts the desired seamless typing experience without these elements being visible.
Pardon my lengthy explanation; accuracy and detail were key objectives here.