In my site I have an area where users can send messages to other users that has the username of the person they are sending it too automatically entered into the textarea used for the messages followed by a space and a dash and then another space and then I want the user to be able to enter their message after that so it appears something like this:-
Hi Rahim. Thanks for the reply. That looks good but I need it to work on the fly i.e. as the user is actually entering text. Will that work as the user is entering text into a textarea?
That looks good but I need it to work on the fly i.e. as the user is actually entering text. Will that work as the user is entering text into a textarea?
In short, no it wont. The text field is tried to the browser (actually more to the the operating system than the browser), so it's going to behave the way the OS works.
There might be a way to "listen" to the inputs with javascript, and add a 'newline' character in certain places.
Thanks october wind. I know what you mean now. After looking more closely it seems that Twitter also does it the way I posted above i.e. the www... would go onto a new line rather than truncating.
Bookmarks